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 (Clang 3.8.0) (judge verdict: Accepted)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
  char name[11];
  int cnt;
} dic_t;
int compare_string(const void *a, const void *b) {
  return strcmp(( char * )a , ( char * )b );
}
int compare_int(const void *a, const void *b){
  //  return ((dic_t*)a)->cnt - ((dic_t*)b)->cnt;
}

int main(void){
  int i,j;
  //  dic_t dic[200000];
  char ii[200000][11];
  char aa[11];
  int len,flg;
  int cnt,maxcnt;
  scanf("%d",&len);
  for(i=0;i<len;i++){
    scanf("%s\n",ii[i]);
    //    printf("i %d s:%s\n",i,aa);

    /*
      for(j=0;j<i;j++){
          if(strcmp(aa,dic[j].name) == 0){
                dic[j].cnt++;
              break;
            }
      }
      //        printf("i %d j%d\n",i,j);
      if(j==i){
        strcpy(dic[j].name,aa);
        dic[j].cnt++;
        //    printf("cpyi %d s:%s\n",j,dic[j].name);
      }
      printf("i %d s:%s\n",i,dic[i].name);
    */
  }
  //  qsort(dic,  len,sizeof(dic), compare_int);
  qsort(ii,  len,sizeof(ii[0]), compare_string);
maxcnt = 1;	
cnt = 1;
  for(i=1;i<len;i++){
	if (strcmp(ii[i-1],ii[i]) == 0){
		cnt++;	
		if(maxcnt < cnt){
			maxcnt = cnt;
        }
    }
    else{
      cnt=1;
    }
    //    printf("afi %d s:%s cnt:%d\n",i,ii[i].name,dic[i].cnt);
//        printf("afi %d s:%s maxcnt:%d\n",i,ii[i],maxcnt);
  }
//          printf("maxcnt %d\n",maxcnt);
cnt = 1;
  for(i=0;i<len;i++){
//          printf("i %d cnt %d maxcnt %d %s %s\n",i,cnt,maxcnt,ii[i-1],ii[i]);
	if (maxcnt == 1){
        printf("%s\n",ii[i]);
    }

    
    if (strcmp(ii[i-1],ii[i]) == 0){
		cnt++;	
//          printf("cnt %d maxcnt %d\n",cnt,maxcnt);
      if(maxcnt <= cnt){
        printf("%s\n",ii[i]);
        }
    }
    else{
      cnt=1;
    }
  }
  return 0;
}