#C7411. Top Student Finder

    ID: 51280 Type: Default 1000ms 256MiB

Top Student Finder

Top Student Finder

Given a list of students with their scores, determine the student with the highest score. If there are multiple students with the same highest score, output the first student encountered with that score.

The input consists of an integer \( n \) (\( n \ge 0 \)), representing the number of students, followed by \( n \) lines. Each line contains a student's name (a string without spaces) and an integer score separated by a space.

This problem can be formulated as follows: Given a sequence of pairs \( (name_i, score_i) \) for \( i = 1, 2, \dots, n \), find the index \( k \) such that \( score_k = \max_{1\le i \le n} score_i \). In case of a tie, choose the smallest index. If no students are provided (i.e. \( n = 0 \)), output an empty string.

inputFormat

The first line contains an integer \( n \), the number of students.

The next \( n \) lines each contain a student's name and an integer score, separated by a space.

outputFormat

Output the name of the student with the highest score. If no student is provided (i.e. \( n = 0 \)), output an empty string.

## sample
4
Alice 78
Bob 94
Charlie 94
Dave 90
Bob