#C6354. Ranking Participants Based on Scores and Submission Times

    ID: 50105 Type: Default 1000ms 256MiB

Ranking Participants Based on Scores and Submission Times

Ranking Participants Based on Scores and Submission Times

Given a list of participants with their corresponding points and submission timestamps, your task is to rank them. The ranking is determined primarily by the participant's points in descending order and, in the event of a tie, by their submission time in ascending order.

Each participant's data is provided in the format: Identifier Points YYYY-MM-DD HH:MM:SS. The ranking criteria can be formally described by the following condition:

\( \text{Rank}(a) p_b \) or \( p_a = p_b \) and \( t_a < t_b \), where \( p \) is the number of points and \( t \) is the submission timestamp.

Output the participant identifiers sorted according to the above criteria, separated by a single space.

inputFormat

The first line of input contains a single integer \( N \) representing the total number of participants. The following \( N \) lines each contain a participant's data in the format: Identifier Points YYYY-MM-DD HH:MM:SS.

outputFormat

Output a single line containing the participant identifiers sorted according to their rank, separated by a single space.

## sample
4
alice 23 2023-08-17 14:32:20
bob 26 2023-08-17 14:30:10
charlie 23 2023-08-17 14:30:09
diana 25 2023-08-17 14:30:11
bob diana charlie alice