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)

/*
 * main.c
 *
 *  Created on: 2019/12/29
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)

char S[200001][11] = {0};
char ans[200001][11] = {0};
int check[200001] = {0};
int check2[200001] = {0};

int sort_dic(const void *a, const void *b)
{
    char *pa = (char *)a;
    char *pb = (char *)b;
    int i = 0, val = 0;
    for (i = 0; i < 10; i++) {
    	char da = pa[i];
    	char db = pb[i];
    	if (da == db) {
    		continue;
    	} else {
    		if (da > db) {
    			val = 1;
    			break;
    		} else {
    	        val = -1;
    	        break;
    		}
    	}
    }
    return val;
}


int main()
{
	int N = 0, i = 0, j = 0;
	memset(check, -1, sizeof(check));
	memset(check2, -1, sizeof(check2));
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%s", &(S[i][0]));
	}

	qsort(S, N, (sizeof(char) * 11), sort_dic);

	int max = 0, count = 1;
	for (i = 0; i < N-1;i++) {
		if (check[i] != -1) {
			continue;
		}
		check[i] = 1;
		for (j = i+1; j < N;j++) {
			if (check[j] != -1) {
				continue;
			}
			if (strcmp(S[i], S[j]) == 0) {
				count++;
				check[j] = 1;
			} else {
				break;
			}
		}
		max = MAX(max, count);
		count = 1;
	}

	count = 1;
	for (i = 0; i < N;i++) {
		if (check2[i] != -1) {
			continue;
		}
		check2[i] = 1;
		for (j = i+1; j < N;j++) {
			if (strcmp(S[i], S[j]) == 0) {
				count++;
				check2[j] = 1;
			} else {
				break;
			}
		}
		//printf("count=%d j = %d\n", count, j);
		if (max == count) {
			printf("%s\n", S[i]);
		}
		count = 1;
	}
    return 0;
}