P5740 【Shenji 7. Example 9】The Best Student.

Description

There are $N$ students taking the final exam, and you are given each student's information: name (a string of at most $8$ characters, consisting only of lowercase English letters), and scores in Chinese, Math, and English (all natural numbers not exceeding $150$). The student with the highest total score is the best. Please output the best student's information (name and scores for each subject). If there are multiple students with the same total score, output the one that appears earlier.

Input Format

The first line contains a positive integer $N$, representing the number of students. Starting from the second line, there are $N$ lines. In each line, first input a string representing the student's name, then input three natural numbers representing the scores of Chinese, Math, and English. They are separated by spaces.

Output Format

Output the best student.

Explanation/Hint

It is guaranteed that $1 \leq N \leq 1000$. The name is a string of length at most $8$, and the scores of Chinese, Math, and English are all natural numbers not exceeding $150$. Translated by ChatGPT 5