#K33297. Highest Scores Extraction

    ID: 25056 Type: Default 1000ms 256MiB

Highest Scores Extraction

Highest Scores Extraction

You are given a list of names along with their respective scores. Your task is to extract the names that have the highest score and print them in the order they first appear in the input.

Formally, let \(N\) be the number of entries. Each entry consists of a name (a string without spaces) and an integer score. Let \(M = \max\{s_1, s_2, \ldots, s_N\}\). Print each name along with its score if its score equals \(M\). The relative order should be the same as the input order.

Example: For the input

4
Alice 91
Bob 85
Charlie 78
Diana 91

the output should be

Alice 91
Diana 91

inputFormat

The first line contains an integer \(N\) representing the number of entries.

The following \(N\) lines each contain a name and an integer score separated by a space.

outputFormat

Output the names and scores of the entries whose score equals the maximum score, in the same order as they appear in the input. Each valid entry should be printed on a separate line with the name and the score separated by a space.

## sample
4
Alice 91
Bob 85
Charlie 78
Diana 91
Alice 91

Diana 91

</p>