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)
{

    long ui_inputPaperNum;
    scanf("%ld", &ui_inputPaperNum);

    char ca_inputString[ui_inputPaperNum][11];
    int i_inputStringCount[ui_inputPaperNum];
    for (int index = 0; index < ui_inputPaperNum; index++)
    {
        i_inputStringCount[index] = 0;
    }
    char c_duplicationFlag = 0;
    long ui_containedIndex = 0;
    for (int count = 0; count < ui_inputPaperNum; count++)
    {
        char ca_checkString[11] = {'\0'};
        scanf("%s", ca_checkString);
        if (count != 0)
        {
            for (int index = 0; index < count; index++)
            {
                if (strcmp(ca_checkString, ca_inputString[index]) == 0)
                {
                    i_inputStringCount[index] += 1;
                    c_duplicationFlag = 1;
                    // break;
                }
            }
            if (c_duplicationFlag != 1)
            {
                for (int index = 0; index < 11; index++)
                {
                    ca_inputString[ui_containedIndex][index] = ca_checkString[index];
                }
                i_inputStringCount[ui_containedIndex] = 1;
                ui_containedIndex += 1;
            }
            c_duplicationFlag = 0;
        }
        else
        {
            i_inputStringCount[0] = 1;
            for (int index = 0; index < 11; index++)
            {
                ca_inputString[0][index] = ca_checkString[index];
            }
            ui_containedIndex = 1;
        }
    }

    long ui_maxCount = 0;
    long ui_maxContainedIndex = 0;
    int count = 0;
    while (i_inputStringCount[count] > 0)
    {
        count++;
    }
    char ca_maxLengthString[count][11];
    for (int index = 0; index < ui_containedIndex; index++)
    {
        if (i_inputStringCount[index] > ui_maxCount)
        {
            for (int index = 0; index < count; index++)
            {
                for (int index2 = 0; index2 < 11; index2++)
                {
                    ca_maxLengthString[index][index2] = '\0';
                }
            }
            for (int index2 = 0; index2 < 11; index2++)
            {
                ca_maxLengthString[0][index2] = ca_inputString[index][index2];
            }
            ui_maxCount = i_inputStringCount[index];
            ui_maxContainedIndex = 1;
        }
        else if (i_inputStringCount[index] == ui_maxCount)
        {
            for (int index2 = 0; index2 < 11; index2++)
            {
                ca_maxLengthString[ui_maxContainedIndex][index2] = ca_inputString[index][index2];
            }
            ui_maxContainedIndex++;
        }
    }

    if (ui_maxContainedIndex == 1)
    {
        printf("%s\n", ca_maxLengthString[0]);
    }
    else
    {
        for (int index1 = 0; index1 < ui_maxContainedIndex; index1++)
        {
            for (int index2 = 0; index2 < index1; index2++)
            {
                if (strcmp(ca_maxLengthString[index1], ca_maxLengthString[index2]) < 0)
                {
                    char tmp[11];
                    for (int repeat = 0; repeat < 11; repeat++)
                    {
                        tmp[repeat] = ca_maxLengthString[index1][repeat];
                        ca_maxLengthString[index1][repeat] = ca_maxLengthString[index2][repeat];
                        ca_maxLengthString[index2][repeat] = tmp[repeat];
                    }
                }
            }
        }
        for (int index = 0; index < ui_maxContainedIndex; index++)
        {
            printf("%s\n", ca_maxLengthString[index]);
        }
    }
    
}