Apollo is playing an interesting computer game. There are N rounds in the game.
At each round, the computer will give Apollo two integers (

and

), and Apollo can do
exactly one of the following three actions.
- Apollo can do nothing.
- If integer
has not been selected in all previous rounds, Apollo can select integer
. - If integer
has not been selected in all previous rounds, Apollo can select integer
.
Apollo has cracked the game, and he has known all the candidate numbers of each round before the game starts. Now he wants to know the maximum number of integers he can select with the optimal strategy.
I believe it would be very simple question for you, please help Apollo solve this question.
输入描述:
The first line is an integer
(
), which is the number of test cases.
Each test case begins with a line containing a positive integer N (
), indicating the number of rounds in this game.
Then N lines follow. The i-th line contains two integers
and
(
,
), indicating that two integers of the i-th round.
输出描述:
For each test case, output one line containing
, where x is the test case number and y is the answer.
示例1
输入
复制
2
6
1 2
2 3
3 4
1 4
1 3
2 4
5
1 2
1 2
1 3
2 3
5 6