#P5740. 【深基7.例9】最厉害的学生

【深基7.例9】最厉害的学生

Problem Description

There are NN students taking the final exam, and you are given each student's information: name (a string of at most 88 characters, consisting only of lowercase English letters), and scores in Chinese, Math, and English (all natural numbers not exceeding 150150). 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 NN, representing the number of students.

Starting from the second line, there are NN 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.

3
senpai 114 51 4
lxl 114 10 23
fafa 51 42 60
senpai 114 51 4

Hint

It is guaranteed that 1N10001 \leq N \leq 1000. The name is a string of length at most 88, and the scores of Chinese, Math, and English are all natural numbers not exceeding 150150.

Translated by ChatGPT 5