Meeting Room Arrangement#6948

Meeting Room Arrangement

1 second
128 megabytes
Easy

Faculty of Engineering of PSU has a large meeting room for faculty staff to organize events and meetings. The use of the meeting room must be reserved in advance. Since the meeting room is available in hours per day and there may be several events that want to use the meeting room, the best usage policy is to maximize the number of events in a day.

Suppose that the meeting room is available from time to ( hours). Given the list of start time and finish time of each candidate event, you are to write a program to select the events that fit in the meeting room (i.e. their times do not overlap) and give the maximum number of events in a day.

Input

The first line is a positive integer (1 \leq n \leq 100) which determines the number of days (test cases). Each test case consists of the time of the candidate events (less than events). Each event time includes integers which are start time () and finish time (), 0 \leq s \leq 9, 1 \leq f \leq 10 and s < f.

The line containing indicates the end of each test case. Note that an event must use at least hour.

Output

For each test case, print out the maximum number of events that can be arranged in the meeting room.

Examples

Example 1

Loading
Loading