#P1104. Birthday Sorting

    ID: 13093 Type: Default 1000ms 256MiB

Birthday Sorting

Birthday Sorting

cjf wants to investigate the birthdays of every student in the school's OI team and sort them by age from oldest to youngest. Since cjf is busy with homework, you are required to help sort the birthdays.

Each student’s birthday is provided in the format YYYY MM DD. The older the student, the earlier the birthday. Therefore, you should sort the birthdays in ascending order (i.e. the earliest date comes first).

Note: You may assume that the input data is valid and consists of three integers per line representing the year, month, and day respectively.

inputFormat

The first line contains an integer n (n ≥ 1) representing the number of students. This is followed by n lines, each containing three integers separated by spaces: year, month, and day, which represent a student's birthday.

outputFormat

Output the sorted list of birthdays in the same format (year month day per line), starting with the oldest (i.e. the smallest date) and ending with the youngest.

sample

3
2000 1 1
1999 12 31
2001 6 15
1999 12 31

2000 1 1 2001 6 15

</p>