eolymp
bolt
Try our new interface for solving problems
Problems

Sort the people

Sort the people

There are $n$ people, each has a name, a surname and a year of birth. Sort them first lexicographically by surname, then by name. If there are several people with the same surname and name, then arrange them in descending order of their year of birth. \InputFile The first line contains the number of people $n~(1 \le n \le 100)$. Each of the next $n$ lines contains name, surname and year of birth of one person. Name and surname contain no more that $20$ characters. \OutputFile Print the data about people according to the sorting condition.
Time limit 1 second
Memory limit 128 MiB
Input example #1
6
Mila Catron 1977
Ivan Mendel 1956
Mihail Egorov 1980
Eric Catron 1977
Mihail Egorov 1988
Petr Mendel 1990
Output example #1
Eric Catron 1977
Mila Catron 1977
Mihail Egorov 1988
Mihail Egorov 1980
Ivan Mendel 1956
Petr Mendel 1990
Author Mykhailo Medvediev