#P2A. Winner(胜利者)

Winner(胜利者)

机翻

在Berland流行的纸牌游戏 "Berlogging "的赢家是根据以下规则决定的。如果在游戏结束时,只有一个玩家拥有最大点数,他就是赢家。如果这种玩家的数量超过一个,情况会变得更加困难。在每个回合中,玩家获得或失去特定数量的积分。在游戏过程中,分数被登记在 "姓名分数 "一行,其中姓名是玩家的名字,分数是本轮获得的分数,是一个整数。如果分数为负数,这意味着该玩家在这一轮中输了。因此,如果两个或更多的玩家在游戏结束时拥有最大的分数(例如,等于m),那么他们中首先得到至少m分的人就会获胜。最初,每个玩家都有0分。保证在游戏结束时,至少有一个玩家有正数的分数。

第一行包含一个整数n(1≤n≤1000),n是游戏的轮数。然后是n行,包含按时间顺序排列的 "姓名分数 "格式的回合信息,其中姓名是一串小写拉丁字母,长度从1到32,分数是-1000到1000之间的整数,包括在内。

打印赢家的名字。

Description

The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a player gains or loses a particular number of points. In the course of the game the number of points is registered in the line "name score", where name is a player's name, and score is the number of points gained in this round, which is an integer number. If score is negative, this means that the player has lost in the round. So, if two or more players have the maximum number of points (say, it equals to m) at the end of the game, than wins the one of them who scored at least m points first. Initially each player has 0 points. It's guaranteed that at the end of the game at least one player has a positive number of points.

The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer number between -1000 and 1000, inclusive.

Print the name of the winner.

Input

The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer number between -1000 and 1000, inclusive.

Output

Print the name of the winner.

Samples

3
mike 3
andrew 5
mike 2
andrew
3
andrew 3
andrew 2
mike 5
andrew