Олимпиадный тренинг

Задача 34824. Listings by class


Input

Each line first contains the class number (a number equal to 9, 10 or 11), then (separated by a space) — last name of the student.

Imprint

It is necessary to display a list of students by grade: first, all students in grade 9, then — 10, then — 11. Within the same class, the order of output of last names should be the same as on the input.

Examples

input
9 Ivanov
10 Petrov
11 Sidorov
9 Grigoryev
9 Sergeev
10 Yakovlev

output
9 Ivanov
9 Grigoryev
9 Sergeev
10 Petrov
10 Yakovlev
11 Sidorov