The day of the competitors#2041

The day of the competitors

1 second
122.174 megabytes
Hard

The International Olympiad in Informatics is approaching, and the Vietnamese national team needs to select the best contestants from across the country. As a result of the selection process, talented contestants were chosen and numbered from to . To determine the strongest contestants, three competitions were held. Each of the contestants participated in all three competitions, and no two contestants obtained the same result in any competition.

A contestant is said to be better than contestant if is ranked higher than in all three competitions. A contestant is called the best if there is no other contestant who is better than . The team leaders want to determine how many best contestants there are among all the selected ones.

Input

The first line contains the number of test cases t~(1 \le t \le 100).

The first line of each test case contains an integer n~(3 \le n \le 10^5) — the number of contestants. Each of the next lines contains three integers a_i, b_i, c_i~(1 \le a_i, b_i, c_i \le n) — the ranks obtained by the -th contestant in the first, second, and third competitions, respectively.

Output

For each test case, print one integer on a separate line — the number of best contestants.

Examples

Example 1

Loading
Loading