#t553. 活动日程排序
活动日程排序
Activity Schedule Sorting
Problem Description
Xiao Ming has activity arrangements. Each activity has an activity name, year, month, day, hour, and minute.
Sort them by start time from earliest to latest.
If two activities have exactly the same start time, sort them by activity name in ascending lexicographic order.
Input Format
The first line contains an integer .
The next lines each contain: activity name, year, month, day, hour, minute. The activity name contains no spaces.
Output Format
Output lines, each in the format: activity name year-month-day hour:minute.
Month, day, hour, and minute are all output as two digits, padding with leading zeros if necessary.
Sample Input
4
Meeting 2024 5 1 9 0
Lunch 2024 5 1 12 0
Exam 2024 4 30 14 30
Party 2024 5 1 9 0
Sample Output
Exam 2024-04-30 14:30
Meeting 2024-05-01 09:00
Party 2024-05-01 09:00
Lunch 2024-05-01 12:00
Sample Explanation
There are activities in the sample. Their start times are: Meeting at 2024-05-01 09:00, Lunch at 2024-05-01 12:00, Exam at 2024-04-30 14:30, Party at 2024-05-01 09:00.
Sorting from earliest to latest, Exam has the earliest date, so it ranks first. The remaining three activities are all on 2024-05-01, among which Meeting and Party share the same time 09:00; comparing by activity name lexicographically, Meeting comes before Party, so Meeting ranks second and Party third. Lunch's time is 12:00, ranking last.
When outputting, month, day, hour, and minute are padded to two digits, so May becomes 05, the 1st becomes 01, 9 o'clock becomes 09, and 0 minutes becomes 00, giving the sample output.
Constraints
.