1432 - KILLER

Time Limit: 1s Memory Limit: 128MB

Submissions: 597 Solved: 184
Description

There are n Killers in a city.Each killer want to kill a killer(maybe a suicide) and if A want to kill B , there will not be another killer want to kill B. Killers kill their aim by turn and we ensure that in the end ,there will be at most one killer still alive. If there is one killer not be killed in the end, he will be the king of killer.Can you tell me the number of killer who can be the king of killer?

Input

 

The first line is an integer T indicating the number of test cases.

    Next T block, each block is a test case.

    First line of each block is a integer N ( 1 <= N <= 100000 )

    Followed by N lines, each line is two integers A B , indicating that A will kill B.

Output

The number of killer who can be the king of killer.

Sample Input
2
2
1 2
2 1
1
1 1
Sample Output
2
0
Hint
Source