It's been a month and LCC is back at it again! To celebrate this contest happening again, Larry wants to find out the top 2 results from last year's contest. However, since there were different contests last year, Larry has to add all of them up to see who had the best total score.
Since Larry is too lazy to do the addition to add up all of the scores, he has decided to make you do it for him.
Input Specification
The first line will contain an Integer , the number of teams Larry is comparing.
The next lines will first contain a string between to characters, the name of the LCC team, and then integers , , , , and , , each being the team's score for one of the LCC's. The string is guaranteed to only contain letters from a
to z
.
Output Specification
On the first line, print the name of the LCC team with the highest total score, along with their score, separated by a space. If two teams have the same score, the lexicographically least has the higher priority.
On the second line, print the name of the LCC team with the second highest total score, along with their score, separated by a space.
Sample Input 1
3
a 6 10 9 4 20
b 7 9 5 18 19
c 0 17 16 5 15
Sample Output 1
b 58
c 53
Sample Input 2
4
hewmatt 120 150 100 100 100
hewmattt 100 90 110 130 140
bot 100 100 100 100 100
a 90 100 90 100 90
Sample Output 2
hewmatt 570
hewmattt 570
Explanation for Sample Output 2
Even though they have the same score, "hewmatt" is lexicographically smaller than "hewmattt" so "hewmatt" is first.
Comments