LearnPy Hub
← Tuples & Sets problems
Medium

Rank Students

Read n lines of name mark. Store them as tuples and print the names sorted by mark from highest to lowest, with equal marks in alphabetical order, one per line.

Input

n, then n lines.

Output

n lines.

Sample 1

Input
3
Mim 80
Rafi 90
Sara 80
Output
Rafi
Mim
Sara

Sample 2

Input
1
A 5
Output
A
solution.py
Output appears here
Rank Students · Python practice problem · LearnPy Hub