Personal files#1344

Personal files

1 second
128 megabytes
Very easy

One day, a secretary mixed up the students' personal files. Now, these files need to be sorted first by class, and within each class, by surname.

Input

The first line contains the number of personal files (1 \le N \le 1000). Then, for each of the students, the following data is provided (each on its own line): surname and name, class, birth date. Surname and name are strings of no more than characters. The class is a string consisting of a number (from to ) and a letter (from "A" to "Z"). The birth date is in the format "DD.MM.YY". It is guaranteed that within the same class there are no students with the same surname.

Output

Output lines, each containing the data for one student. The lines should be sorted first by class, and then by surname.

Examples

Example 1

Loading
Loading

Example 3

Loading
Loading