Problem:
Score: 300 points

Problem Statement

We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.

Print all strings that are written on the most number of votes, in lexicographical order.

Constraints

1 \leq N \leq 2 \times 10^5

S_i (1 \leq i \leq N) are strings consisting of lowercase English letters.

The length of S_i (1 \leq i \leq N) is between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print all strings in question in lexicographical order.

Sample Input 1

7
beat
vet
beet
bed
vet
bet
beet

Sample Output 1

beet
vet

beet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.

Sample Input 2

8
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo

Sample Output 2

buffalo

Sample Input 3

7
bass
bass
kick
kick
bass
kick
kick

Sample Output 3

kick

Sample Input 4

4
ushi
tapu
nichia
kun

Sample Output 4

kun
nichia
tapu
ushi

Solution in C (GCC 5.4.1) (judge verdict: Time Limit Exceeded)

#include <stdio.h>
#include <string.h>

int main(void)
{

    // 投票用紙枚数の取得
    int i_inputPaperNum;
    scanf("%d", &i_inputPaperNum);

    // 投票用紙に書かれた文字列の取得とソート
    char ca_inputString[i_inputPaperNum][11];
    char *p_inputString[i_inputPaperNum];
    for (int index = 0; index < i_inputPaperNum; index++)
    {
        scanf("%s", ca_inputString[index]);
        p_inputString[index] = (char *) &ca_inputString[index];
        if (index != 0)
        {
            for (int count = 0; count < index; count++)
            {
                if (strcmp(p_inputString[index], p_inputString[count]) < 0)
                {
                    char *tmp;
                    tmp = p_inputString[index];
                    p_inputString[index] = p_inputString[count];
                    p_inputString[count] = tmp;
                }
            }
        }
    }

    // 投票回数の判定
    int i_count = 1;
    int i_countBuffer = 0;
    int i_max = 0;
    int i_containedCount = 0;
    char *displayString[i_inputPaperNum];
    for (int index = 0; index < i_inputPaperNum - 1; index++)
    {
        if (strcmp(p_inputString[index], p_inputString[index + 1]) == 0)
        {
            i_count++;
        }
        else
        {
            if (i_count > i_countBuffer)
            {
                displayString[0] = p_inputString[index];
                i_containedCount = 1;
                i_countBuffer = i_count;
                i_count = 1;
            }
            else if (i_count == i_countBuffer)
            {
                displayString[i_containedCount] = p_inputString[index];
                i_containedCount++;
                i_count = 1;
            }
        }
    }
    if (i_count > i_countBuffer)
    {
        displayString[0] = p_inputString[i_inputPaperNum - 1];
        i_containedCount = 1;
    }
    else if (i_count == i_countBuffer)
    {
        displayString[i_containedCount] = p_inputString[i_inputPaperNum - 1];
        i_containedCount++;
    }

    // 結果の出力
    for (int count = 0; count < i_containedCount; count++)
    {
        printf("%s\n", displayString[count]);
    }

    return 0;

}