#P437. 练76.1生日排序

练76.1生日排序

Description

At the beginning of the semester, the teacher wants to collect everyone's birthday and sort them from earliest to latest.

Input Format

The first line contains an integer nn (1n1001≤n≤100), representing the number of students in the class.
The next nn lines each contain a string ss and three integers yy, mm, dd, indicating that the student named ss was born on yy year mm month dd day.
All dates are guaranteed to be valid, and the name consists of lowercase letters and is no more than 2020 characters long.

Output Format

Output nn lines, each containing a string representing a name. If two students have the same birth date, the one who appears later in the input should be output first.

Sample

3
qwb 1996 6 30
gyt 1995 7 28
wc  1996 6 30
gyt
wc
qwb