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>

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

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

int ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	char *p = s--;
	do *++s = gc();
	while (*s > ' ');
	*s = 0;
	return s - p;
}

void outs(char *s) { while (*s) pc(*s++); pc('\n'); }

// 文字列のハッシュ関数
#define HASHSIZ 2000081
typedef struct { char *s; int id; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash + HASHSIZ;

int insert(char *s, int id) {
	unsigned long long i;
	int j;
	char *p;
	HASH *tp;

	i = 0, p = s;
	for (j = 0; *p; j++) i = (i << 5) + (*p++ +1-'a');
	tp = hash + (int)(i % HASHSIZ);
	while (tp->s != NULL) {
		if (!strcmp(tp->s, s)) return tp->id;
		if (++tp == hashend) tp = hash;
	}
	tp->s = s, tp->id = id;
	return -1;
}

#define MAX 200005
typedef struct { char *p; int n; } T;
T tbl[MAX];
char S[MAX][12];

void Qsort(int l, int r) {
	int i, j;
	char *m;

	i = l, j = r, m = tbl[(l+r) >> 1].p;
	while (1) {
		while (strcmp(tbl[i].p, m) < 0) i++;
		while (strcmp(m, tbl[j].p) < 0) j--;
		if (i >= j)	break;
		char *t = tbl[i].p; tbl[i].p = tbl[j].p, tbl[j].p = t;
		i++, j--;
	}
	if (l+1 < i) Qsort(l, i-1);
	if (j+1 < r) Qsort(j+1, r);
}

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

	N = in();
	ma = 0;
	while (N--) {
		ins(tbl[K].p = S[K]);
		if ((i = insert(S[K], K)) < 0) i = K++;
		if (++tbl[i].n > ma) ma = tbl[i].n;
	}
	i = 0;
	for (j = 0; j < K; ++j) if (tbl[j].n == ma) {
		tbl[i++].p = tbl[j].p;
	}
	N = i;
	Qsort(0, N-1);
	for (i = 0; i < N; ++i) outs(tbl[i].p);
	return 0;
}