#K35342. Highest Scoring Player

    ID: 25510 Type: Default 1000ms 256MiB

Highest Scoring Player

Highest Scoring Player

You are given a series of events. Each event is represented by a player's name and an integer representing the points gained or lost by that player. The overall score for a player is the sum of all points from the events in which they participated. Your task is to determine the player with the highest cumulative score. In the case of multiple players having the same highest score, output the one with the lexicographically smallest name.

Input Format:The first line of input contains an integer N denoting the number of events. Each of the next N lines contains an event in the format name points, where name is a string without spaces and points is an integer value (which may be negative).

Output Format: Print a single line containing the name of the player with the highest score.

Note: In the event of a tie, the player with the lexicographically smallest name is selected.

inputFormat

The input is read from stdin and is formatted as follows:

  1. The first line contains an integer N, the number of events.
  2. Each of the next N lines contains an event with a player's name and an integer (points), separated by a space.

outputFormat

The output is written to stdout and should consist of a single line containing the name of the player with the highest cumulative score. If there is a tie, output the lexicographically smallest name.

## sample
1
alice 10
alice

</p>