You are the author of a testing system that sorts teams according to ACM rules. The teams are numbered from 1 to n 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 n (1≤n≤1000) that participate in competition. The information about i-th team is given in the i (1≤i≤n)-th next line:
the team name, no more than 20 characters;
the number of solved problems s (0≤s≤100);
the penalty time t (0≤t≤1000) of the team.
Print the information about the teams in sorted order as shown in the example.