#K47252. Student with the Highest Grade

    ID: 28157 Type: Default 1000ms 256MiB

Student with the Highest Grade

Student with the Highest Grade

You are given a list of students with their respective grades. Your task is to determine which student has the highest grade. If there is a tie (i.e., multiple students have the same highest grade), the student who appears first in the list should be chosen.

The problem can be formalized as follows:

Given an integer \( n \) representing the number of students, followed by \( n \) lines where each line contains a student's name and an integer grade, find the name of the student with the highest grade. In the event of a tie, the student who appears earliest in the input is selected.

inputFormat

The first line of input contains an integer \( n \) representing the number of students. The following \( n \) lines each contain a student's name (a string without spaces) and an integer representing the student's grade, separated by a space.

outputFormat

Output the name of the student with the highest grade. If multiple students share the highest grade, output the name of the student who appeared first in the input.

## sample
1
John 89
John

</p>