Problem
Annual grades in nine subjects for the 9th grade of each of the
N
students of the class are printed in the form of a table (in the first line - the grades of the first student, in the second - the second, etc.). The student's last name is in the first column. It is necessary to display this table in descending order of the average score. If the average score is equal, output the last names in the order they appear in the source data.
Input
The input to the program is:
- in the first line the number
N
- the number of students (
1<=N<=25
);
- followed by
N
lines, in the format <
surname
(sequence of Latin characters)> <
grade
1st item> <
grade
2nd item>
...
<
grade
for the 9th item>.
Imprint
Display a table written in descending order of the average score for all subjects in the format:
<
LastName
> <
Average score
(accurate to 6 decimal places)>
If the average score is equal, output the last names in the order in which they appear in the source data.
Examples
# |
Input |
Output |
1 |
3
Sidorov 1 1 1 1 1 1 1 1 1
Ivanov 5 5 5 5 5 5 5 5 5
Petrov 4 4 4 4 4 4 4 4 4
|
Ivanov 5.000000
Petrov 4.000000
Sidorov 1.000000 |