It Can Be Arranged#7217

It Can Be Arranged

2 seconds
64 megabytes
Easy

Every year, several universities arrange inter-university national programming contests. ACM ICPC Dhaka site regional competition is held every year in Dhaka and one or two teams are chosen for ACM ICPC World Finals.

By observing these, MMR (Mission Maker Rahman) has made a plan to open a programming school. In that school courses are taught. Each course is taught every day (otherwise, programmers may forget DP while learning computational geometry!). You will be given the starting time a_i and finishing time b_i (inclusive) of each course (1 \le i \le n). You will be also given the number of students registered for each course s_i (1 \le i \le n). You can safely assume no student has registered to two different courses. MMR wants to hire some rooms of a building, named Sentinel Tower, for running that school. Each room of Sentinel Tower has a capacity to hold as much as students. The programmers (students) are very restless and a little bit filthy! As a result, when course is taken in a class room, after the class is finished, it takes \text{clean}_{ij} time to clean the room to make it tidy for starting teaching course immediately just after course in the same room.

Your job is to help MMR to decide the minimum number of rooms needed to be hired to run the programming school.

Input

Starts with the number of test cases (t \le 100). Each case starts with two integers (1 \le n \le 100), number of courses and (1 \le m \le 10000), capacity of a room. Next lines will contain three integers a_i, b_i (0 \le a_i \le b_i \le 10000000) and s_i (1 \le s_i \le 10000), starting and finishing time of a course. Next lines will contain the clean time matrix, where the -th row will contain integers \text{clean}_{ij} (1 \le i \le n, 1 \le j \le n, 0 \le \text{clean}_{ij} \le 10000000, \text{clean}_{ii} = 0).

Output

For each case, print the test case number, starting from , and the answer, minimum number of rooms needed to be hired.

Examples

Example 1

Loading
Loading