题目描述
Note: For Turbo C++, select "Text" as your language
Problem description:
ProCon Junior gives you chance to earn points for admission in IIIT Delhi. So, it is not easy to get points. If you solve this problem you are one more step closer to earn points. Solve this problem and earn points.
Problem:
In IIIT Delhi we play lot of games and Balls is one of them. In this game the winner is one who scores maximum points at the end of game. Game has various levels. You will be given name of player who wins the round and his/her score after each round. Rest of the players are given 0 score for that round. After the end of all the rounds points of all players are calculated and the one with the maximum score wins the game.
Now, you need to tell who wins the game. It is guaranteed that there is only 1 winner. Good luck !!!!!
Input
First line contains T denoting number of test cases.
First line of each contains N denoting number of rounds.
Next N line contains space separated string and an integer denoting name of the winner of that round and his score in that round.
Output
For each test case output a single line containing the name of the winner of the game and his/her final score.
Constraints
1 ≤ T ≤ 10
No of unique names = 15
1 ≤ N ≤ 100
1 ≤ score[i] ≤ 100
Example
Input:
3
2
Ashish 2
Ayush 3
3
Ashish 2
Ashish 4
Ayush 5
3
Ayush 2
Aneesh 5
Ashish 3
Output:
Ayush 3
Ashish 6
Aneesh 5
Explanation
Test case 1: Since score of Ayush is more after the end of the game, winner is Ayush.
Test case 2: Since score of Ashish is more after the end of the game so the winner is Ashish.
Test case 3: Since score of Aneesh is more after the end of the game, winner is Aneesh.
输入格式
见题面
输出格式
见题面