Consider n segments on a two-dimensional plane, where the endpoints of the i-th segment are (li, i) and (ri, i). One can put as many tokens as he likes on the integer points of the plane (recall that an integer point is a point whose x and y coordinates are both integers), but the x coordinates of the tokens must be different from each other.
What's the maximum possible number of segments that have at least one token on each of them?
The first line of the input contains an integer T (about 100), indicating the number of test cases. For each test case:
The first line contains one integer n (1 ≤ n ≤ 105), indicating the number of segments.
For the next n lines, the i-th line contains 2 integers li, ri (1 ≤ li ≤ ri ≤ 109), indicating the x coordinates of the two endpoints of the i-th segment.
It's guaranteed that at most 5 test cases have n ≥ 100.
For each test case output one line containing one integer, indicating the maximum possible number of segments that have at least one token on each of them.
2
3
1 2
1 1
2 3
3
1 2
1 1
2 2
3
2
For the first sample test case, one can put three tokens separately on (1, 2), (2, 1) and (3, 3).
For the second sample test case, one can put two tokens separately on (1, 2) and (2, 3).
| Name |
|---|


