LearnPy Hub
← Tuples & Sets problems
Medium

Sort by Second

Read n, then n lines of name score. Print the names sorted by score from high to low; break ties by name in alphabetical order.

Input

n, then n lines.

Output

n lines.

Sample 1

Input
3
Mim 90
Rafi 85
Sara 90
Output
Mim
Sara
Rafi

Sample 2

Input
1
A 1
Output
A
solution.py
Output appears here
Sort by Second · Python practice problem · LearnPy Hub