ADA Training CP

The day of the competitors

Time limit 1 second
Memory limit 122 MiB

The International Olympiad in Informatics is coming and the leaders of the Vietnamese Team have to choose the best contestants all over the country. Fortunately, the leaders could choose the members of the team among n very good contestants, numbered from 1 to n. In order to select the best contestants the leaders organized three competitions. Each of the n contestants took part in all three competitions and there were no two contestants with equal results on any of the competitions. We say that contestant А is better than another contestant В when А is ranked before В in all of the competitions. A contestant A is said to be excellent if no other contestant is better than A. The leaders of the Vietnamese Team would like to know the number of excellent contestants.

Input data

First line contains number of test cases t (1t100 ). Then descriptions of t test cases follow. First line of description contains the number of competitors n (3n100000). Each of the next n lines describes one competitor and contains integer numbers a[i], b[i], c[i] (1a[i], b[i], c[i]n) separated by spaces, the order of i-th competitor's ranking in the first competition , the second competition and the third competition.

Output data

For each test case in the input your program should output the number of excellent contestants in one line.


Input example #1
1 2 3
2 3 1
3 1 2
Output example #1