eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Birthdates

Birthdates

Write a program to identify the youngest person and the oldest person in a class. \InputFile The number \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{100}) in the first line determines the number of people in a class. The following \textbf{n} lines contain person’s name and his/her birthdate. The information in each line is of this format: \textbf{personName dd mm yyyy} where \textbf{personName} is a single word less than \textbf{15} letters, \textbf{dd mm yyyy} are date, month and year of the birthdate. Suppose that no one has the same name or the same birthdate. \OutputFile Print out \textbf{2} lines containing the name of youngest person and oldest person, respectively.
Лимит времени 2 секунды
Лимит использования памяти 64 MiB
Входные данные #1
5
Mickey 1 10 1991
Alice 30 12 1990
Tom 15 8 1993
Jerry 18 9 1990
Garfield 20 9 1990
Выходные данные #1
Tom
Jerry
Источник ACM-ICPC Asia Hatyai Regional Programming Contest – November 16, 2012 – PSU, Hatyai