#C13621. Top Three Students by Average Grade

    ID: 43180 Type: Default 1000ms 256MiB

Top Three Students by Average Grade

Top Three Students by Average Grade

You are given information about n students. Each student record includes the student's name, age, and their scores in three subjects: math, science, and English. Your task is to calculate the average grade for each student using the formula:

\(\text{average} = \frac{\text{math} + \text{science} + \text{english}}{3}\)

After computing the averages, sort the students in descending order by their average grade and output the names of the top three students. If the number of students is less than three, output all the student names in sorted order.

The solution should read the input from stdin and output the result to stdout with names separated by a single space.

inputFormat

The first line contains an integer n representing the number of students. The following n lines each contain a student's record with 5 fields separated by spaces: name (a string), age (an integer), and three integers representing the scores in math, science, and english.

outputFormat

Output a single line containing the names of the top three students (or all if less than three) sorted in descending order of their average grade. The names should be separated by a single space.

## sample
6
Alice 17 65 70 78
Bob 16 55 58 62
Charlie 18 72 66 80
David 17 85 90 88
Eva 16 92 95 91
Frank 17 40 42 38
Eva David Charlie