ACM Sort
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
You are the author of a testing system that sorts teams according to ACM rules. The teams are numbered from to according to the order they appear in the input. Ranked teams are ordered according to the following rules:
by the number of solved problems in descending order;
if the number of solved problems is equal — by the penalty time in ascending order;
if all mentioned parameters are equal — by the team number in ascending order.
Input
First line contains the number of teams that participate in competition. The information about -th team is given in the -th next line:
the team name, no more than characters;
the number of solved problems ;
the penalty time of the team.
Output
Print the information about the teams in sorted order as shown in the example.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 46%