Kashyap is playing a message passing game with his friends. Kashyap always starts the game. At the beginning of the game, Kashyap will pass the message to some of the players. When a player receives a message, he may pass the message to some of the other players.A player will not pass the message to someone who has already received the message.A player may also choose not to spread the message.At the end of the game, everyone would have received the message. After the game, each player writes his Id and Sum of Ids of the players to whom he passed the message. Find out the ID of Kashyap.
First line will have an integer T which denotes the number of test cases.
First line of each test case contains N which denotes the number of players.
Next N lines contains two integers A and B
A denotes the id of the person
B denotes the sum of ids of the players to whom he passed the message.
IDs of the players are always unique.
For each test case, print the ID of Kashyap.
Input: 2 3 1 5 2 0 3 0 3 1 2 2 3 3 0 Output: 1 1
Example case 1. there are 3 people in the game. Player 1 has passed the message to 2 and 3. Player 2 and Player 3 have not passed any message.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions