Problem

13 /19


Luggage storage

Problem

The program receives information about the passengers who checked in their luggage in the luggage room. The first line contains the current time: two integers separated by a colon, corresponding to hours (from 00 to 21, exactly 2 characters) and minutes (from 00 to 59, exactly 2 characters). The second line specifies the number of passengers N, which is not less than 10, but does not exceed 1000. Each of the following N lines contains information about passengers in the following format: 
<Lastname> <Cell release time>,
where <Lastname> – a string of no more than 20 characters without spaces, <Cell Release Time> – separated by a colon, two integers corresponding to hours (from 00 to 21, exactly 2 characters) and minutes (from 00 to 59, exactly 2 characters). <Surname> and <Cell Release Time> separated by exactly one space.

Example input strings
10:00
3
Ivanov 12:00
Petrov 10:12
Sidorov 12:12 

The program should display a list of passengers who must vacate their cells in the next 2 hours, as well as those who have already vacated them. The list should be sorted in chronological order of cell release. In this case, the program should output 
Petrov
Ivanov