#C3910. Student Sorting

    ID: 47390 Type: Default 1000ms 256MiB

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:

  1. Grade (in ascending order)
  2. Last name (in lexicographical order)
  3. Age (in ascending order)
  4. 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:

(grade,last_name,age,ID)(grade, \text{last\_name}, age, ID)

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>