#K90372. Reservation Filter

    ID: 37738 Type: Default 1000ms 256MiB

Reservation Filter

Reservation Filter

You are given a list of reservation records for a restaurant. Each record contains a unique booking ID, customer name, table size, and the reservation time in HH:MM 24-hour format. Your task is to filter out and return the booking IDs of the reservations that match a given table size and fall within a specified time window.

The time window is defined by a start time and an end time (inclusive), and the booking IDs should be returned sorted by their reservation time in ascending order.

Note: The reservation time is given in the format \(HH:MM\) (e.g., 18:30). You can compare these times as strings since the format allows for lexicographical comparison.

inputFormat

The first line contains an integer n, the number of reservations.

The second line contains three values separated by spaces: an integer table_size, a string start_time and a string end_time, which represent the desired table size and the inclusive time window (in \(HH:MM\) format) respectively.

Each of the following n lines contains a reservation record with 4 space-separated fields: booking_id (a string), customer_name (a string without spaces), table_size (an integer), and reservation_time (in \(HH:MM\) format).

outputFormat

Output a single line containing the filtered booking IDs separated by a single space. If no reservation matches the criteria, output an empty line.

## sample
5
4 18:00 20:00
A001 JohnDoe 4 18:30
A002 JaneDoe 2 19:00
A003 Alice 4 20:00
A004 Bob 4 21:30
A005 Charlie 2 18:45
A001 A003