시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 1147 853 771 75.293%

문제

어떤 반에 있는 학생들의 생일이 주어졌을 때, 가장 나이가 어린 사람과 가장 많은 사람을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 반에 있는 학생의 수 n이 주어진다. (1 ≤ n ≤ 100)

다음 n개 줄에는 각 학생의 이름과 생일이 "이름 dd mm yyyy"와 같은 형식으로 주어진다. 이름은 그 학생의 이름이며, 최대 15글자로 이루어져 있다. dd mm yyyy는 생일 일, 월, 연도이다.

이름이 같거나, 생일이 같은 사람은 없다.

출력

첫째 줄에 가장 나이가 어린 사람의 이름, 둘째 줄에 가장 나이가 많은 사람 이름을 출력한다.

예제 입력 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
W3sicHJvYmxlbV9pZCI6IjU2MzUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMwZGRcdWM3N2MiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzViNFx1YjVhNCBcdWJjMThcdWM1ZDAgXHVjNzg4XHViMjk0IFx1ZDU1OVx1YzBkZFx1YjRlNFx1Yzc1OCBcdWMwZGRcdWM3N2NcdWM3NzQgXHVjOGZjXHVjNWI0XHVjODRjXHVjNzQ0IFx1YjU0YywgXHVhYzAwXHVjN2E1IFx1YjA5OFx1Yzc3NFx1YWMwMCBcdWM1YjRcdWI5YjAgXHVjMGFjXHViNzhjXHVhY2ZjIFx1YWMwMFx1YzdhNSBcdWI5Y2VcdWM3NDAgXHVjMGFjXHViNzhjXHVjNzQ0IFx1YWQ2Y1x1ZDU1OFx1YjI5NCBcdWQ1MDRcdWI4NWNcdWFkZjhcdWI3YThcdWM3NDQgXHVjNzkxXHVjMTMxXHVkNTU4XHVjMmRjXHVjNjI0LjxcL3A+XHJcbiIsImlucHV0IjoiPHA+XHVjY2FiXHVjOWY4IFx1YzkwN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