#C3394. Sort Students by Total Score

    ID: 46816 Type: Default 1000ms 256MiB

Sort Students by Total Score

Sort Students by Total Score

You are given information for n students. Each student has a name and two scores. Your task is to compute the total score for each student, defined as \(score_1 + score_2\), and then output the student names sorted in descending order of total score. In case two or more students have the same total score, sort their names in alphabetical order.

Note: Use standard input (stdin) for reading input and standard output (stdout) for printing the result.

inputFormat

The first line of input contains an integer n which is the number of students. Each of the following n lines contains a student's name followed by two integer scores separated by spaces.

Example:

4
Alice 90 95
Bob 80 85
Charlie 85 90
David 90 95

outputFormat

Output the names of the students sorted as described. Print each name on a new line.

For the sample input above, the output should be:

Alice
David
Charlie
Bob
## sample
4
Alice 90 95
Bob 80 85
Charlie 85 90
David 90 95
Alice

David Charlie Bob

</p>