#K49017. Track Highest Scores

    ID: 28549 Type: Default 1000ms 256MiB

Track Highest Scores

Track Highest Scores

In this problem, you are given a number \(n\) representing the number of rounds, followed by \(n\) rounds of scores. In each round, a participant's username and score are provided.

Your task is to determine the highest score obtained by each participant. The output should list each participant along with their highest score, and the list must be sorted in alphabetical order of the participant names.

For each participant, if they appear in multiple rounds, only the maximum score is considered.

inputFormat

The first line of input contains an integer \(n\) — the number of rounds. Each of the following \(n\) lines contains a participant's username (a string without spaces) and an integer score separated by a space.

Example Input:

5
john 150
ann 200
john 180
ann 220
tom 90

outputFormat

Output the highest score for each participant, with one participant per line. Each line should contain the username and the highest score separated by a space. The output must be sorted alphabetically by the username.

Example Output:

ann 220
john 180
tom 90
## sample
1
alice 100
alice 100

</p>