Birthday
InterviewTime limit1sMemory limit128 MB
Given each student's name and birthday, print the name of the youngest student, then the oldest.
- Level
Easy2 of 10
- Topics
- Implementation, Sorting, Array
- Solved
- No attempts yet
Problem
Given the birthdays of the students in a class, write a program that finds the youngest student and the oldest student.
Input
The first line contains the number of students in the class. ()
Each of the next lines contains a student's name and birthday in the format "name dd mm yyyy". The name is that student's name, consisting of at most 15 characters. dd, mm, and yyyy are the day, month, and year of the birthday. (, , ) Every given birthday is a valid date, and the year, month, and day do not have leading zeros.
No two students share the same name or the same birthday.
Output
Print the name of the youngest student on the first line, and the name of the oldest student on the second line.