#C3910. Student Sorting
Student Sorting
Student Sorting
You are given a list of students, where each student is described by four attributes: an integer ID, a float grade, an integer age, and a string last name. Your task is to sort the students in ascending order based on the following criteria:
- Grade (in ascending order)
- Last name (in lexicographical order)
- Age (in ascending order)
- ID (in ascending order)
Mathematically, if a student is represented as a tuple ((ID, grade, age, \text{last_name})), then the sorting key is given by:
All input is read from standard input and all output should be written to standard output.
inputFormat
The input begins with an integer (n) representing the number of students. Each of the following (n) lines contains four values: the student's ID (integer), grade (float), age (integer), and last name (string), separated by a single space.
outputFormat
Output (n) lines, each line containing the student's details in the following order: ID, grade, age, and last name. The values should be separated by a single space.## sample
6
102 8.5 20 Smith
101 8.5 19 Johnson
104 7.8 22 Clark
106 8.5 19 Adams
105 9.0 21 Brown
103 7.8 23 Miller
104 7.8 22 Clark
103 7.8 23 Miller
106 8.5 19 Adams
101 8.5 19 Johnson
102 8.5 20 Smith
105 9.0 21 Brown
</p>