#K72752. Top Students Ranking

    ID: 33823 Type: Default 1000ms 256MiB

Top Students Ranking

Top Students Ranking

You are given a list of students along with their scores. Your task is to determine the top 5 students with the highest scores. In case of a tie, the student with the lexicographically smaller name should come first. More formally, sort the students by descending score and in the case of equal scores, sort by ascending order of names. That is, the sorting rule is: sort by \(-score\) and then by \(name\) (in lexicographical order).

If there are fewer than 5 students, output all of them following the same sorting rule. The output should list the names separated by a single space.

inputFormat

The first line contains an integer \(N\) representing the number of students. Each of the next \(N\) lines contains a student’s name (a string without spaces) and a floating-point score, separated by space.

outputFormat

Output a single line containing the names of the top 5 students (or all if fewer than 5) sorted by descending score and lexicographical order (if scores are equal). The names should be separated by a single space. If there are no students, output an empty line.

## sample
7
Alice 88.00
Bob 92.50
Catherine 87.75
David 92.50
Eva 90.00
Frank 85.50
Grace 88.00
Bob David Eva Alice Grace

</p>