LearnPy Hub
← Recursion & Lambda problems
Medium

Sort Records

Read n lines of name age (n first). Print the names sorted by age, oldest first, using a lambda key. Ties: alphabetical name.

Input

n, then n lines.

Output

One line.

Sample 1

Input
3
Mim 20
Karim 65
Rafi 30
Output
Karim Rafi Mim

Sample 2

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