"The Book Vault Canal" is a canal that allows ships to travel between the Oldmarket and Spawnlands regions of Payneful S3. The canal is crucial to connect two major bodies of water, hence the amount of ships that pass through each day. However, one day, Bob and his friends decided to rudely waddle across the canal, stopping ships for minutes! Now, there is a huge backlog of ships waiting to cross the canal. You don't know which ships came first, and you are about to have a panic attack when you realize you have a megaphone and a ship list at your disposal. You can call out ship numbers, but you need to call them in the order that they came! Please, determine which order the ships should cross the canal!
Input Specifications
The first line will contain the integer, .
The next
lines will contain
, the ship number of the
th ship, and
, the time at which the
th ship should cross the canal.
All times will be written in the form DD/MM HH:MM
(that is day, then month, then hour, then minute), with the time being in 24-hour format. Assume all dates occur during the same year (in other words, January 1 will always come before December 31.)
Output Specifications
Output lines, with each line containing a ship number. The ship numbers should be printed in order of first to enter the canal, to last to enter the canal.
Subtasks
All times are distinct, valid times.
All ship numbers are guaranteed to be positive, distinct, and less than .
Subtask 1 [30%]
Subtask 2 [70%]
No additional constraints.
Sample Input
4
801248 30/04 11:27
195826 30/04 15:18
444187 01/05 08:15
68253 30/04 00:54
Sample Output
68253
801248
195826
444187
Explanation for Sample Output
Remember that a 24-hour clock goes from 00:00
to 23:59
.
Comments