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 <stdlib.h>
#include <math.h>
#include <string.h>

int mojime = 0;

typedef struct {
    char name[15];
    int cnt;
}list_t;

int cmp(const void* p, const void* q) {
    return ((list_t*)q)->cnt - ((list_t*)p)->cnt;
}

int compare_string(const void* p, const void* q) {
    return strcmp(((list_t*)p)->name, ((list_t*)q)->name);
}

int main() {
    int n, kind = 0;
    char s[15] = { 0 };
    list_t list[200000] = { 0 };
    int max = 0;
    int temp = 0, max_n = 0;

    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%s", s);
        //printf("kind=%d\n", kind);
        for (int j = 0; j <= kind; j++) {
            if (strcmp(s, list[j].name) == 0) {
                list[j].cnt++;
                if (max_n <= list[j].cnt) max_n = list[j].cnt;
                break;
            }
            else if (j == kind) {
                list[kind].cnt++;
                if (max_n <= list[kind].cnt) max_n = list[kind].cnt;
                strcpy(list[kind].name, s);
                kind++;
                break;
            }
        }
    }
    qsort(list, kind, sizeof(list_t), compare_string);
    //for (int i = 0; i < kind; i++) printf("list[%d].cnt=%d\n", i, list[i].cnt);
    for (int i = 0; i < n; i++) {
        if (list[i].cnt==max_n) printf("%s\n", list[i].name);
    }
    
    return 0;
}