Ranking
문제
Charlotte Michelle Simone is organizing the Especially Interesting Olympiad. Now she has the solutions of all the participants and needs to compile the ranking.
There are several tasks in the olympiad. Each participant can submit any number of solutions for each task, and each solution scores some number of points. The score of a participant for a task is the maximum of the scores of their solutions for that task (or zero, if they did not submit any solutions for that task). The total score of a participant is the sum of their scores over all tasks.
Write a program to compile the ranking of the participants according to their total scores.
입력
The first line contains an integer , the number of solutions submitted ().
Each of the following lines describes one solution, giving the account name of the participant, the name of the task, and the number of points the solution scored, separated from each other by spaces. Each account name and each task name consists of 1 to 20 lower-case letters of the Latin alphabet. Each solution may score 0 to 100 points (always an integer).
You may assume that there are no more than participants and no more than tasks.
출력
Output one line per participant, listing their account name and total score, separated by a space. The lines should be ordered in the non-increasing order of the scores. The lines with equal scores may be listed in any order.
예제
예제 1
6 juku tul 3 mari har 5 mari har 4 juku har 4 mari tul 1 mari tul 5
mari 10 juku 7