Олимпиадный тренинг

Задача 38244. Strong password


Задача

Темы:
Eighth grader Benjamin uses as passwords only the words that are in the dictionary he has at home. Benjamin also knows that his five-year-old brother Denis dreams of hacking his page on a popular social network. Every time Benjamin enters the password, Denis stands by and tries to remember what buttons his brother presses on the keyboard. Unfortunately, Denis does not have a very good memory, so he remembers only the first letter of the password, and when Benjamin leaves for school, he takes a dictionary that lies at their place (Denis knows for sure that Benjamin uses a word from this dictionary as a password), and tries in turn all the words beginning with this letter as a password, and tries them in alphabetical order.

Using the list of all the words in the dictionary, help Benjamin choose a password. It should be such that Denis has to go through as many options as possible before he finds the right one.

Input
In the first line enter N — the number of words in the dictionary (1 ≤ N ≤ 103). The next N lines contain the words — strings no longer than 255 characters, consisting only of small Latin letters. The words are sorted alphabetically.

Imprint
Output the desired password. If there are several matching passwords, print the one that comes last in the dictionary.

Examples
# Input Output
1 7
archimed
computer
contest
informatics

python
team
python