LearnPy Hub
← Dictionaries problems
Medium

Group by Grade

Read n lines of name grade (n first). Print each grade in alphabetical order followed by the names with that grade in input order: A: Mim Sara.

Input

n, then n lines.

Output

One line per grade.

Sample 1

Input
4
Mim A
Rafi B
Sara A
Tuhin C
Output
A: Mim Sara
B: Rafi
C: Tuhin

Sample 2

Input
1
X A
Output
A: X
solution.py
Output appears here
Group by Grade · Python practice problem · LearnPy Hub