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.
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.
Print the information about the teams in sorted order as shown in the example.