#C11752. Most Scoring Player
Most Scoring Player
Most Scoring Player
You are given a game record where each round is denoted by a pair of integers representing the player ID and the points scored by that player in that round. The goal is to determine the player with the highest overall score. The overall score for each player is computed as:
$$ S_i = \sum_{j} score_{ij} $$
If there is a tie in total scores, the tie-breaker is the maximum score the player achieved in any single round. Should the tie persist, choose the player with the smallest player ID.
Note: The input is read from standard input and the output should be printed on standard output.
inputFormat
The first line of input contains an integer n representing the number of rounds played.
The next n lines each contain two space-separated integers. The first integer is the player ID and the second integer is the score obtained in that round.
outputFormat
Print a single integer to standard output – the player ID who meets the criteria described above.
## sample5
1 200
2 300
1 150
2 350
3 300
2