The Trudeau Computer Science Club is famous in Pierre Elliott Trudeau High School for having the best computer scientists in the whole school present in one room. Every week,
lectures his dedicated pupils (with PowerPoint) on some cool computer science concept in hopes that they will do well on the CCC.Unfortunately, it is nearing the time to write power rankings! The power rankings are a ranking of Trudeau computer scientists. Obviously,
and are at the top, so doesn't have to worry about where to place those two.However, the other students in the Trudeau Computer Science Club have barely written any contests and as a result, it can be hard to rank them properly. Instead,
checks their progress on online judges to see how many homework problems they have completed, but that didn't help either since they barely even looked at the homework.As a last resort,
hid secret cameras around their houses to find out how many minutes they spent reviewing his PowerPoints. As controversial as this technique is, is now able to see how dedicated his students are.He decides that the greater the total time a student spends on his PowerPoints, the better the ranking that student should receive. Specifically, the ranking of a student is 3 plus the number of students with a greater total time. It is guaranteed that no two students have the same total time.
However,
has a computer science project due in June and he needs your help in determining the power rankings.Given the names of students and how long each student spends on each of his PowerPoints, can you determine the power rankings?
'sInput Specification
The first line of input will contain and .
The next lines will contain the names of 's students. Names are unique, will not exceed 50 characters, and will only contain printable non-whitespace ASCII characters.
The next lines will contain space-separated integers; the integer on line specifies the amount of time (in minutes) the student spent on the PowerPoint. No student spends a negative number of minutes studying, nor more than minutes on a single PowerPoint.
Output Specification
On separate lines, from the best rank (lower number) to the worst rank (higher number), output the rank, followed by a period and a single space, and the name of the student with that rank.
Sample Input
5 3
EnochPoon
LiuJason
Nathanl3
AlexW
TT1103
3 4 2 1 0
1 3 4 2 0
5 1 7 4 0
Sample Output
3. Nathanl3
4. EnochPoon
5. LiuJason
6. AlexW
7. TT1103
Comments
Nah... I'm too lazy to do your homework.
But you still spent time on the powerpoints