#K55087. Sort Reservations by Check-in Date

    ID: 29897 Type: Default 1000ms 256MiB

Sort Reservations by Check-in Date

Sort Reservations by Check-in Date

You are given a list of reservations, each containing a reservation ID, a guest name, and a check-in date. Your task is to sort these reservations in ascending order based on their check-in date.

The check-in date is provided in the format \(\texttt{YYYY-MM-DD}\). You must read the list from standard input and output the sorted list to standard output.

Ensure that your solution handles cases where the list might be empty or contains a single entry.

inputFormat

The first line of input contains an integer \(n\) indicating the number of reservations. The following \(n\) lines each contain a reservation details in the format:

reservationId guestName checkInDate

Here, reservationId is an integer, guestName is a string (without spaces), and checkInDate is a string in the format \(\texttt{YYYY-MM-DD}\).

outputFormat

Output the sorted reservations, one per line in the same format as the input:

reservationId guestName checkInDate

The reservations must be sorted in ascending order by checkInDate.

## sample
3
1 Alice 2023-10-01
2 Bob 2023-09-27
3 Charlie 2023-10-05
2 Bob 2023-09-27

1 Alice 2023-10-01 3 Charlie 2023-10-05

</p>