Nico's going skydiving! Unfortunately, no one knows anything about skydiving, so this problem will gloss over what skydiving actually entails.
Nico has planned out different skydiving excursions that she wants to pursue. Alas, there are only so many hours in a day, and so Nico
might not be able to pursue all of them. Specifically, the
excursion takes
units of time to complete and must be completely
done by
. Nico wishes to maximize the number of unique excursions she goes on. Help her!
Constraints
The sum of over all test cases is at most
.
Subtask 1 [1 point]
Subtask 2 [1 point]
Subtask 3 [1 point]
No additional constraints.
Input Specification
The first line contains a single integer, .
test cases follow.
The description for each test case starts with a single integer , the number of excursions for that test case.
lines follow, each containing two integers,
and
, the parameters for the
excursion.
Output Specification
Output lines. On the
line, output the maximum number of unique excursions that Nico can go on.
Sample Input 1
3
4
1 2
2 4
3 6
4 8
4
3 4
1 1
1 1
2 2
3
7 8
3 9
5 10
Sample Output 1
3
2
2
Sample Explanation 1
For the first test case, Nico can pick the first three excursions.
For the second test case, Nico can pick the first two excursions. Note that Nico must pursue the second excursion before the first one.
For the third test case, Nico can pick the third excursion, then the second excursion.
Comments