#K49442. Most Played Song

    ID: 28643 Type: Default 1000ms 256MiB

Most Played Song

Most Played Song

You are given a list of n songs, where each song is described by its name and a play count. Your task is to determine the song with the highest play count. In the event of a tie, return the song with the lexicographically smallest name.

Note: Lexicographical order is the order in which words or strings are arranged in a dictionary. For example, apple comes before banana because 'a' is lexicographically smaller than 'b'.

The problem can be formally described using the following formula:

\[ \text{result} = \min\{ s \mid p(s) = \max_{s'\in S} p(s') \} \]

where \(S\) is the set of songs, and \(p(s)\) denotes the play count of song s.

inputFormat

The first line contains an integer n, representing the number of songs. The following n lines each contain a song's name and its play count separated by a space. Song names will not contain spaces.

Example:

3
songa 30
songb 30
songc 10

outputFormat

Output a single line containing the name of the song with the highest play count. If multiple songs have the same highest play count, output the lexicographically smallest among them.

## sample
1
singlesong 1
singlesong