#P104. [Sleeping Cup #4] Football Loser
[Sleeping Cup #4] Football Loser
Person in Charge
Attention
This problem requires file I/O (football.in / football.out).
Problem Background
To celebrate the 1st anniversary of Sleeping Cup, Sleeping Dolphin and its friends participated in a football match called Sleeping Cup World Cup Qualifiers on the morning of April 12, 2025. Team C suffered a crushing 0-7 defeat against Team J.
However, the head coach believed the team's strategy was not the issue—it was simply that the players were too inexperienced.
The members of Team C were at a loss, so they turned to you for help in analyzing the problem.
Problem Description
There are teams, each with a name . Each team has two positive integers and , representing the player ability score and the coach ability score, respectively.
Additionally, the team's assembly time must also be considered.
The total evaluation score is calculated as follows:
Your task is to compare the total evaluation scores of each team and output their names in descending order of .
Input Format
There are multiple test cases.
The first line contains an integer , the number of test cases.
For each test case:
- The first line contains an integer , the number of teams.
- The next lines each start with a string , the team name, followed by three positive integers , representing the player ability score, coach ability score, and assembly time, respectively.
It is guaranteed that:
- No ties will occur.
- No two teams will share the same name.
- Team names consist only of uppercase and lowercase letters.
Output Format
For each test case, output one line listing the team names in descending order of their total evaluation scores.
Samples
1
2
Sleeping 7 3 5
Cup 7 3 6
Cup Sleeping
2
1
Sleeping 77 5 6
3
C 7 3 4
h 7 3 5
n 7 3 6
Sleeping
n h C