405231: GYM101853 F Working Time

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Working Timetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Working time is the period of time that a person spends at paid labor.

You are given the working record of an employee containing the starting and ending time of work in n days. Your task is to determine if that employee worked sufficiently during these n days. An employee is considered to be worked sufficiently if the total number of working hours during the n days is at least m hours.

Input

The first line contains an integer T (1 ≤ T ≤ 300), in which T is the number of test cases.

The first line of each test case contains two integers n and m (1 ≤ n ≤ 100) (0 ≤ m ≤ 2400), in which n is the number of working days, and m is the minimum number of required working hours during these n days.

Then n lines follow, each line contains two strings s and e, in which s is the starting time of work, and e is the ending time of work. Both times are given in the format hh:mm, where hh represents the hours and mm represents the minutes. It is guaranteed that the ending time is not less than the starting time, and both times will be in one day. Times are given in 24-hour time notation.

The sum of n overall test cases does not exceed 2 × 104.

Output

For each test case, print "YES" if the employee is considered to be worked sufficiently. Otherwise, print "NO".

ExampleInput
3
2 15
08:00 16:00
07:55 16:12
2 20
08:00 18:30
07:30 17:00
3 35
10:00 16:00
08:05 16:37
11:07 15:30
Output
YES
YES
NO
Note

In the 24-hour time notation, the day begins at midnight, 00:00, and the last minute of the day begins at 23:59.

In this problem, the ending minute is not counted. For example, consider a person who started working at 00:00 and fished at 00:10, then the total number of working minutes is 10.

加入题单

算法标签: