| UTPC Spring 2023 Contest (HS) |
|---|
| Finished |
Yuji and his friends are having a jujutsu duel at the dojo. To be able to come up with a fair tournament style, their instructor Satoru has decided to use a ranking system that takes various factors into account such as kicking skill, magic skill, speed, and of course demon slaying skill.
Satoru has a list of all of the students at the dojo, though it is not sorted according to any particular criteria. He would like it to be such that the students are sorted in descending order of demon slaying skill, with ties broken by descending order of magic skill, ties then being broken by descending order of kicking skill, and then ties being broken by descending order of speed, and finally if there are still ties, to break those by ascending lexicographical order of name.
Unfortunately, Satoru's list of students is quite long and he, being a busy jujutsu teacher, has employed your help to sort the list of students according to the above process. Given their stats and names, can you help Satoru out by reporting the names of the students in sorted order?
The input will begin with an integer $$$N$$$ ($$$1 \leq N \leq 100$$$) denoting the number of students at the dojo. The next $$$n$$$ lines will each contain a description of a student in the form $$$n, k, m, s, d$$$ ($$$1 \leq |n|, k, m, s, d \leq 100$$$) representing their name, kicking skill, magic skill, speed, and demon slaying skill respectively.
It is guaranteed that each student's name consists of only lowercase English letters and that all student names are unique.
The output should consist of $$$N$$$ lines, the names of the students in sorted order.
4 ryomen 20 20 20 20 suguru 30 10 40 50 maki 10 10 90 90 nobara 70 60 50 40
maki suguru nobara ryomen
| Name |
|---|


