Problem: Campus Ambassador has organized a Coding Contest in his college. Contest has multiple rounds, in each round a participant may gain or lose few points. At the end, there is only one participant with the maximum points. In the course of the contest, the number of points is written in the line as

"name points", where name is the participant's name and points is, the number of points is gained.

If the point is negative, this means the participant has lost in the round. If two partcipants have the maximum number of points, then winners is the one who scored at least m points first.

Intially each participant has 0 points. It's guranteed that at the end of the game at least one participant has a positive number of points.

Input

The first line contains an integer N, total number of rounds. Then follow N lines, containing information about the rounds in "name points" format in chronological order.

Output

Print the Name of the winner of the Contest.

Constraints

1 ≤ N ≤ 1000

'name' is the string of lower case letter 1 ≤ |name| ≤ 32

-1000 ≤points ≤ 1000

SAMPLE INPUT
3
mini 3
rini 5
mini 2

SAMPLE OUTPUT
rini

Explanation

After the contest both rini and mini have scored same points that is 5 ,
but rini scored 5 points first, hence the winner.

Solution (in PYTHON):

Solution:
n=int(raw_input())
a={}
for i in range(n):
    x,y=raw_input().split()
    y=int(y)
    if not a.has_key(x):
        a[x]=[y,i]
    else:
        a[x][0]+=y
        a[x][1]=i
b=a.items()
b.sort(key=lambda x:(-x[1][0],x[1][1]))
print b[0][0]