Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 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
© 2015 HUST ACMICPC TEAM. All Right Reserved.