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: Accepted)

// ABC 155-C
// 2020.2.16 bal4u

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

typedef long long ll;

#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0; int c;
	do c = gc();
	while (isspace(c));
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

ll ins() { // 文字列の入力　スペース以下の文字で入力終了
    ll n = 0;
	int c;
   	do c = gc();
	while (isspace(c));
    int w = 0;
	do n = (n << 5) + (c - 'a'+1), ++w;
    while ((c = gc()) > ' ');
    return n << 5*(10-w);
}

void outs(ll s) {
    int i;
    char a[20];
    i = 0; while (s) {
        if (s & 31) a[i++] = (s & 31) + 'a'-1;
        s >>= 5;
    }
    while (i--) pc(a[i]);
    pc('\n');
}

// 数値のハッシュ関数
#define HASHSIZ 4999999
typedef struct { ll s; int id; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash + HASHSIZ;

int insert(ll s, int id) {
    HASH *tp = hash + (int)(s % HASHSIZ);
	while (tp->s) {
		if (tp->s == s) return tp->id;
		if (++tp == hashend) tp = hash;
	}
	tp->s = s, tp->id = id;
	return -1;
}

#define MAX 200005
typedef struct { ll s; int n; } T;
T tbl[MAX];

void Usort(T *a, int n) {
	int i, k;
#define B 8
#define BMSK 255 // (1<<8)-1
	int t1[1 << B], t2[1 << B];

	T *tmp = malloc(n * sizeof(T));
	for (k = 0; k < 8; ++k) {  // for 64ビット
		memset(t1, 0, sizeof(t1)), memset(t2, 0, sizeof(t2));
		for (i = 0; i < n; ++i)	t1[(a[i].s >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t1[i+1] += t1[i];
		i = n; while (i--) tmp[--t1[(a[i].s >> k*B) & BMSK]] = a[i];
		k++;
		for (i = 0; i < n; ++i) t2[(tmp[i].s >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t2[i+1] += t2[i];
		i = n; while (i--) a[--t2[(tmp[i].s >> k*B) & BMSK]] = tmp[i];
	}
	free(tmp);
#undef B
}

int main()
{
	int i, N, K, ma;

	ma = 0, K = 0;
    N = in(); while (N--) {
		tbl[K].s = ins();
		if ((i = insert(tbl[K].s, K)) < 0) i = K++;
		if (++tbl[i].n > ma) ma = tbl[i].n;
	}
	N = 0;
	for (i = 0; i < K; ++i) if (tbl[i].n == ma) {
		if (N != i) tbl[N].s = tbl[i].s;
        ++N;
	}
	Usort(tbl, N);
//printf("N=%d\n", N);
	for (i = 0; i < N; ++i) outs(tbl[i].s);
	return 0;
}