#C14404. Most Frequent Word

    ID: 44050 Type: Default 1000ms 256MiB

Most Frequent Word

Most Frequent Word

You are given a list of words. Your task is to determine the word which appears most frequently in the list. In case of a tie (i.e., multiple words have the same highest frequency), output the word that is smallest in lexicographical order.

The input starts with an integer n indicating the number of words. The next line contains n words separated by spaces. If n is 0, then the list is empty and you should output an empty string.

Note: In lexicographical order, for example, 'apple' comes before 'banana'.

Example:

Input:
6
apple banana apple orange banana banana

Output: banana

</p>

Formally, if we denote the frequency of a word w by \( f(w) \), you are to output the word \( w \) that satisfies:

\( f(w) = \max_{u \in Words} f(u) \) and \( w = \min\{ u \mid f(u) = \max_{v \in Words} f(v) \} \).

inputFormat

The input is read from standard input (stdin) and has the following format:

The first line contains an integer n indicating the number of words.
The second line contains n words separated by spaces. If n is 0, the second line will be empty or omitted.

outputFormat

Output to standard output (stdout) the word that appears most frequently. If there is a tie, output the lexicographically smallest word. If no words are provided (i.e. n is 0), output an empty string.

## sample
6
apple banana apple orange banana banana
banana