#K10181. Find the Highest Grade Student
Find the Highest Grade Student
Find the Highest Grade Student
Given a list of student names along with their respective grades, determine the student with the highest grade. In case of a tie where multiple students have the same highest grade, return the lexicographically smallest name.
You are given an integer \(n\) representing the number of students, followed by \(n\) lines. Each line contains a student's name and an integer grade. Formally, given a set \(S = \{(name_i, grade_i) \mid 1 \leq i \leq n\}\), output the name corresponding to the maximum grade. In case of a tie (i.e. \(grade_i = grade_j\) for some \(i \neq j\)), return the name that is smallest in lexicographical order.
inputFormat
The first line contains an integer (n) denoting the number of students. This is followed by (n) lines, each containing a student's name (a string without spaces) and an integer grade separated by a space.
outputFormat
Output a single line containing the name of the student with the highest grade. If multiple students have the highest grade, output the lexicographically smallest name among them.## sample
1
alice 90
alice
</p>