#P1104. 生日

生日

Description

cjf wants to collect the birthdays of every student in the school OI group and sort them by age in descending order (older first). However, cjf has a lot of homework recently and has no time, so please help her sort them.

Input Format

The input contains n+1n + 1 lines.

The first line contains the total number nn of people in the OI group.

Lines 22 to n+1n + 1 each contain one person's name ss, birth year yy, month mm, and day dd.

Output Format

Output nn lines.

Print the names of the students in descending order of age. (If two students share the same birthday, print the one that appears later in the input first.)

3
Yangchu 1992 4 23
Qiujingya 1993 10 13
Luowen 1991 8 1

Luowen
Yangchu
Qiujingya

Hint

It is guaranteed that 1<n<1001 < n < 100 and 1s<201 \leq |s| < 20. The given dates are valid, and the year [1960,2020]\in [1960, 2020].

Translated by ChatGPT 5