Favorite game
During his life, Stepan played in a lot of games. One day, he decided to find out what kind of game he most liked. For this, he decided to count the total time spent for each game. The one for which he had spent the greatest amount of time, is his favorite.
Fortunately, Stepan has his daily diary, where he records the number of minutes spent for each game. Therefore, it is not difficult to find a game in which he played the most time in total. For simplicity, Stepan numbered all the games with integers.
It is guaranteed that Stepan has only one favorite game.
Input
The first line contains the number of records n (1 ≤ n ≤ 1000) in Stepan's diary. Each of the next n lines contain one record - the pair of numbers x[i]
, y[i]
showing that Stepan was in a game x[i]
exactly y[i]
minutes (1 ≤ x[i]
, y[i]
≤ 1000).
Output
Print one number - the number of Stepan's favorite game.