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-----
7
beat
vet
beet
bed
vet
bet
beet

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:
from collections import Counter
n = int(input())
ss = [input() for _ in range(n)]
ss.sort()
c = Counter()
mc = 0
for s in ss:
  c[s] += 1
  mc = max(mc, c[s])
seen = set()
for s in ss:
  if c[s] == mc and s not in seen:
    print(s)
    seen.add(s)

n = int(input())
s_l = [ input() for _ in range(n) ]

d = {}
for s in s_l:
    try:
        d[s] += 1
    except:
        d[s] = 1

max_c = max([ v for _,v in d.items() ])
ans = [ i for i, v in d.items() if v == max_c ]

for i in sorted(ans):
    print(i)

n = int(input())
d = {}
for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
mx = max(d.values())
ans = ['']
for k, v in d.items():
    if v == mx:
        ans.append(k)
ans.sort()
print(*ans, sep='\n')


N = int(input())
d = {}
for _ in range(N):
  p = input()
  if p in d:
    d[p] += 1
  else:
    d[p] = 1
ma = max(d.values())
d2 = sorted(d.items())
d.clear()
d.update(d2)
for k, v in list(d.items()):
  if v == ma:
    print(k)


import collections
n=int(int(input()))
a=[input() for i in range(n)]
m = collections.Counter(a).most_common() 
print('\n'.join(sorted([a for a,b in m if b==m[0][1]])))

import collections
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(map(int, input().split()))
def i_row(N): return [int(input()) for _ in range(N)]
def i_row_list(N): return [list(input().split()) for _ in range(N)]

n=i_input()
ss=[input() for _ in range(n)]
ss.sort()

css=collections.Counter()
for s in ss:
    css[s]+=1
maxapper=max(css.values())

for w in css:
    if css[w]==maxapper:
        print(w)





n=int(input())
dic={}
for i in range(n):
    s=input()
    if not s in dic:
        dic[s]=1
    else:
        dic[s]+=1
max_val=max(dic.values())
a=sorted([i for i, k in dic.items() if k == max_val])
for i in a:
    print(i)

n = int(input())
S = {}
for i in range(n):
    s = input()
    if s not in S.keys():
        S[s] = 1
    else:
        S[s] += 1
m = max(S.values())
ans = []

for key, value in S.items():
    if value == m:
        ans.append(key)
ans.sort()
print(*ans, sep="\n")


n=int(input())
A=[]
for i in range(n):
    a=str(input())
    A.append(a)
import collections
c = collections.Counter(A)
ma= c.most_common()[0][1]
C=[i[0] for i in c.items() if i[1] >=ma ]
C.sort(reverse=False)
for j in range(len(C)):
    print(C[j])

from collections import defaultdict
charnums=defaultdict(int)
N=int(input())
for _ in range(N):
    charnums[input()]+=1
ans=[]
m=max(charnums.values())
for key,value in charnums.items():
    if value==m:
        ans.append(key)
for an in sorted(ans):
    print(an)

import collections
N=int(input())
S=[]
for i in range(N):
  s=input()
  S.append(s)

l=collections.Counter(S)
keys=l.keys()
k=max(l.values())
ans=[]
for i in keys:
  if l[i]==k:
    ans.append(i)

ans.sort()
n=len(ans)

for i in range(n):
  print(ans[i])

import collections
N = int(input())
S = []
ans = []
for i in range(N):
  S.append(input())
d = collections.Counter(S)
ome = max(d.values())
for k, v in list(d.items()):
  if v == ome:
    ans.append(k)
ans.sort()
for x in ans:
  print(x)


N = int(input())

d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)

N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in list(dic.keys()):
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in list(dic.keys()):
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in range(len(ans)):
  print((ans[i]))


N = int(input())
S = []
for i in range(N) :
    S.append(input())
S_set = set(S)
S_sorted = sorted(S)
S_sorted.append("null0")

cntlist = [[S_sorted[0],1]]
j = 0
for i in range(len(S)-1) :
    if cntlist[j][0] != S_sorted[i+1] :
        cntlist.append([S_sorted[i+1],1])
        j = j + 1
    else :
        cntlist[j][1] += 1

maxnum = 0
for i in range(len(cntlist)) :
    maxnum = max(cntlist[i][1],maxnum)
cntlist_new = []
for i in range(len(cntlist)) :
    if cntlist[i][1] == maxnum :
        cntlist_new.append(cntlist[i])
from operator import itemgetter
new_cnt = sorted(cntlist_new,key = itemgetter(0),reverse = False)

#print(S)
#print(S_sorted)
#print(cntlist_new)
#print(new_cnt)

for i in range(len(new_cnt)) :
    print(new_cnt[i][0])

import collections

N = int(input())

Slist = []
for i in range(N):
  Slist.append(input())
#print (Slist)

anslist =sorted(Slist)
c = collections.Counter(anslist)
values, counts = zip(*c.most_common())
maxcount = counts[0]
i = 0
#print (values)
#print (counts)
for i in range(len(values)):
  if maxcount == counts[i]: 
    print (values[i])
    maxcount = counts[i]
    i+=1
  else :
    break

N = int(input())
dic = {}
for _ in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1

lst = []
M = max(dic.values())
for k in dic.keys():
  if dic[k] == M:
    lst.append(k)

lst.sort()

for i in range(len(lst)):
  print(lst[i])

n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)

N = int(input())
dic, rst = {}, []
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

n = int(input())
data = {}
for i in range(n):
    s = str(input())
    if s in data.keys():
        data[s] += 1
    else:
        data[s] = 1
m = max(list(data.values()))
ans = []
for j,k in data.items():
    if k == m:
        ans.append(j)
for l in sorted(ans):
  print(l)

N = int(input())

ss = dict()
for i in range(N):
    s = input()
    ss[s] = ss.get(s, 0) + 1
sss = [(-b, a) for a, b in list(ss.items())]
sss.sort()
maxa = sss[0][0]
for a, b in sss:
    if maxa != a:
        break
    print(b)


n = int(input())
d = {}
max_value = 1
for i in range(n):
	s = input()
	if s in d:
		d[s] += 1
		max_value = max(max_value, d[s])
	else:
		d[s] = 1
l = []
for k in d:
	if d[k] == max_value:
		l.append(k)
for x in sorted(l):
	print(x)


n = int(input())
l = [str(input()) for i in range(n)]

l = sorted(l)

cnt = 1
cnt_max = 1
moji = []

for i in range(1, n):
    if l[i] == l[i-1]:
        cnt += 1
        if i == n-1:
            if cnt_max < cnt:
                cnt_max = cnt
                moji = [l[i-1]]
            elif cnt_max == cnt:
                moji.append(l[i-1])
    else:
        if cnt_max < cnt:
            cnt_max = cnt
            moji = [l[i-1]]
        elif cnt_max == cnt:
            moji.append(l[i-1])
            if cnt_max == 1 and i == n-1:
                moji.append(l[i])
        cnt = 1

for i in range(len(moji)):
    print((moji[i]))





n = int(input())
d = {}

for i in range(n):
    s = input()
    if s not in d:
        d.update({s: 1})
    else:
        d[s] += 1

max_val = max(d.values())
keys_of_max_val = [key for key in d if d[key] == max_val]
print(("\n".join(sorted(keys_of_max_val))))


from collections import Counter
import heapq

n = int(input())
sc = Counter()

for x in range(n):
  s = input()
  sc.update([s])

max_num = sc.most_common()[0][1]
q = []
for v in list(sc.items()):
  if v[1] == max_num:
    heapq.heappush(q, v[0])

for _ in range(len(q)):
  print((heapq.heappop(q)))



N = int(input())
d = {}
for i in range(N):
    s = input()
    if s in d:
        d[s] += 1

    else:
        d[s] = 1


l = sorted(d.items())
M = max(d.values())

for i in l:
    if d[i[0]] == M:
        print(i[0])

from collections import Counter
n=int(input())
s=Counter([input()for _ in[0]*n])
m=s.most_common(1)[0][1]
r=sorted((k for k,v in s.items() if v==m))
for a in r:print(a)

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s = Counter(s)
s = sorted(list(s.items()), reverse=True, key=lambda x: x[1])
max_count = max(list([x[1] for x in s]))
ans = sorted([l for l, c in s if c==max_count])

for a in ans:
    print(a)


N = int(input())
S = sorted([input() for _ in range(N)])
A = []
count = 1
for i in range(N-1):
    if(i == N-2):
        A.append(S[N-1])
    if(S[i] != S[i+1]):
        A.append(S[i])
A.sort()
B = [1]*len(A)
a = 0
for i in range(N-1):
    if(S[i] == S[i+1]):
        B[a] += 1
    else:
        a += 1
m = max(B)
for i in range(len(A)):
    if(B[i] == m):
        print(A[i])

from collections import Counter
n = int(input())
s = list(input() for i in range(n))
c = Counter(s)
m = max(c.values())
s = sorted(list(set(s)))
for i in range(len(s)):
    if c[s[i]] == m:
        print(s[i])

N = int(input())
S = dict()
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1

max_val = max(S.values())
max_key = [key for key in S if S[key] == max_val]
print(("\n".join(sorted(max_key))))


N = int(input())
S = [input() for _ in range(N)]
dict_s = dict()
for s in S:
    if s in dict_s:
        dict_s[s] += 1
    else:
        dict_s[s] = 1

sorted_s = sorted(dict_s.items(), key=lambda x: x[1], reverse=True)
max_s = []
max_count = -1
for s in sorted_s:
    if s[1] >= max_count:
        max_s.append(s[0])
        max_count = s[1]

for s in sorted(max_s):
    print(s)

'''n = int(input())
arr1 = []
arr2 = [0]*n
arr3 = []
for _ in range(n):
    x = input()
    if x not in arr1:
        arr1.append(x)
        arr2[arr1.index(x)] += 1
    else:
        arr2[arr1.index(x)] += 1
arr2 = set(arr2)
max_count = max(list(arr2.values()))
ans = []
for item in arr2.items():
    (key, value) = item
    if value == max_count:
        arr3.append(key)
arr3.sort()
for j in arr3:
    print(j)
'''
n = int(input())
s = [input() for _ in range(n)]
count = {}

for word in s:
    if word not in count:
        count[word] = 1
    else:
        count[word] += 1

max_count = max(list(count.values()))
ans = []
for item in list(count.items()):
    (key, value) = item
    if value == max_count:
        ans.append(key)

ans = sorted(ans)
for w in ans:
    print(w)


import collections
def i_input(): return int(input())


def i_map(): return list(map(int, input().split()))


def i_list(): return list(map(int, input().split()))


def i_row(N): return [int(input()) for _ in range(N)]


def i_row_list(N): return [list(map(int, input().split())) for _ in range(N)]

n=i_input()
ss=[input() for _ in range(n)]
ss.sort()
c = collections.Counter()
for word in ss:
    c[word] += 1

prtcnt=max(c.values())
for word,cnt in list(c.items()):
    if cnt==prtcnt:
        print(word)


d=dict()
for _ in range(int(input())):s=input();d[s]=d.get(s,0)+1
m=max(d.values());i=[k for k,v in d.items()if v==m]
for v in sorted(i):print(v)

import os, sys, re, math

N = int(input())
S = []
for i in range(N):
    S.append(input())

d = {}
for s in S:
    if not s in d:
        d[s] = 0
    d[s] += 1

d = sorted(list(d.items()), key=lambda x:x[1], reverse=True)
names = [v[0] for v in d if v[1] == d[0][1]]

for name in sorted(names):
    print(name)


from collections import Counter

n = int(input())
s = []
for _ in range(n):
    s.append(input())

s.sort()
c = Counter(s)

values = sorted(list(c.values()), reverse=True)
keys = sorted(list(c.keys()))
for item in c:
    if c[item] == values[0]:
        print(item)


def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7

#import numpy as np
import sys
import math
import collections

n = N()
s = {}
for i in range(n):
    a = input()
    if a in s:
        s[a] += 1
    else:
        s[a] = 1

s = sorted(s.items(),key=lambda x:x[1],reverse=True)
m = s[0][1]
s2 = []
for i in range(len(s)):
    if s[i][1] == m:
        s2.append(s[i][0])
    else:
        break

s2.sort()
for i in s2:
    print(i)

N = int(input())
S = []

for i in range(N):
	S.append(str(input()))
S.sort()
S.append(0)

prev_name = S[0]
cnt = 1
names = []
cnts = []
for i in range(1, N + 1):
	if prev_name == S[i]:
		cnt += 1
	else:
		names.append(prev_name)
		cnts.append(cnt)
		prev_name = S[i]
		cnt = 1
max_cnt = max(cnts)

for i in range(len(names)):
	if cnts[i] == max_cnt:
		print(names[i])


n = int(input())
d = {}

for i in range(n):
    st = input()
    if st in list(d.keys()):
        d[st] += 1
    else:
        d[st] = 1

m = max(list(d.values()))
l = []

for x,y in list(d.items()):
    if y == m:
        l.append(x)
l.sort()

for v in l:
    print(v)



#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import collections

def main():
    words=[]
    word_dict=[]
    n = int(input())
    words=[input().rstrip() for _ in range(n)]
    answers=[]

    word_dict = collections.Counter(words)
    max_count=max(word_dict.values())
    [answers.append(values) for values,counts in word_dict.most_common() if counts==max_count]

    for answer in sorted(answers):
        print(answer)

def __starting_point():
    main()
__starting_point()

N = int(input())
S = []
M = 1
count = 1

for _ in range(N):
  S.append(input())

S.sort()
ans=[S[0]]

for i in range(N-1):
  if S[i] == S[i+1]:
    count += 1
  else:
    if M < count:
      M = count
      ans = [S[i]]
    elif M == count:
      ans.append(S[i])
    count = 1
if M < count:
  M = count
  ans = [S[N-1]]
elif M == count:
  ans.append(S[N-1])

ans = list(set(ans))
ans.sort()

for j in range(len(ans)):
  print(ans[j])

import collections
N = int(input())
S = []

for i in range(N):
    S.append(input())

c = collections.Counter(S).most_common()
ans = []

if len(c) == 1:
    ans = c
else:
    for k in range(N):
        if c[0][1] == c[k][1]:
            ans.append(c[k])
        else:
            break
for x in sorted(ans):
    print(x[0])

n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1

m = max(d.values())
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

N = int(input())

d = {}
for _ in (range(N)):
    s = input()
    if s not in d.keys():
        d[s] = 1
    else:
        d[s] += 1

max_n = max(d.values())
ans = []
for key,value in d.items():
    if value == max_n:
        ans.append(key)

ans.sort()
for i in ans:
    print(i)

def main():
	n = int(input())
	d = dict()
	for _ in range(n):
		s = input()
		if s not in list(d.keys()):
			d[s] =1
		else:
			d[s] +=1
	mostFrequent = max(d.values())
	ans = []
	for key in list(d.keys()):
		if d[key] == mostFrequent:
			ans.append(key)
	ans.sort()
	for i in ans:
		print(i)


def __starting_point():
    main()

__starting_point()

import math
import statistics
import collections
a=int(input())
#b,c=int(input()),int(input())
# c=[]
#  for i in b:
#     c.append(i)
#e1,e2 = map(int,input().split())
# f = list(map(int,input().split()))
g = [input() for _ in range(a)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))

g.sort()

ma=0
count=1
#最大値求める
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        ma=max(ma,count)
        count=1

ma=max(ma,count)
count=1
ans=[]
#最大値の位置
for i in range(a-1):
    if g[i]==g[i+1]:
        count+=1
    else:
        if count==ma:
            ans.append(g[i])
        count=1
if count==ma:
    ans.append(g[-1])

for i in ans:
    print(i)


N = int(input())
dic = {}
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

N=int(input())
d=dict()
for _ in range(N):
    S=input()
    if S not in d:
        d[S]=0
    d[S]+=1
M=max(d.values())
ans=[]
for S in list(d.keys()):
    if d[S]==M:
        ans.append(S)
ans.sort()
for S in ans:
    print(S)


import collections

N = int(input())
S = sorted([input() for _ in range(N)])

c = collections.Counter(S)

vmax = max(c.values())

for k, v in c.items():
    if v == vmax:
        print(k)

n = int(input())

dct = {}

for i in range(n):
    s = input()
    if s in dct:
        dct[s] += 1
    else:
        dct[s] = 1

max_num = max(dct.values())
ans = []
sorted_dct = sorted(dct.items())
 
for x in sorted_dct:
    if x[1] >= max_num:
        ans.append(x[0])
 
print(*ans, sep='\n')

N = int(input())
S = [input() for _ in range(N)]

d = {s: 0 for s in set(S)}

for i in range(N):
    d[S[i]] += 1

count = 0
for key in d:
    count = max(count, d[key])

l = []
for key in d:
    if count == d[key]:
        l.append(key)
l.sort()

for s in l:
    print(s)


n = int(input())
dd = {}
for i in range(n):
	s = input()
	if s in dd.keys():
		dd[s] += 1
	else:
		dd[s] = 1
ma = max(dd.values())
lst = []
for k, v in dd.items():
	if v == ma:
		lst.append(k)
for l in sorted(lst):
	print(l)

from collections import defaultdict
n = int(input())
dic = defaultdict(int)
for i in range(n):
    dic[input()] += 1
tmp = [(key, value) for key, value in dic.items()]
tmp.sort(key=lambda x: (x[1], x[0]))
m = tmp[-1][1]
for i in range(len(dic)):
    if tmp[i][1] == m:
        print (tmp[i][0])

import collections

n = int(input())

li=[]


for i in range(n):
    li.append(input())

cnt = collections.Counter(li)
S = cnt.most_common()


C =len(cnt)

li_1 = [S[0][0]]

for i in range(C-1):
    if S[i][1] == S[i+1][1]:
        li_1.append(S[i+1][0])
    else:
        break

li_1.sort()

for i in li_1:
    print(i)


import collections as c
a=c.Counter(input() for _ in range(int(input())));b=a.most_common(1)[0][1]
print(*sorted([i for i,j in a.items() if j==b]),sep='\n')

n = int(input())
d = {}
t = 0
for i in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1
    t = max(t, d[s])
    
for key in sorted(d):
    if d[key] == t:
        print(key)

n = int(input())
d = {}
m = 0
for i in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1
    if m <= d[s]:
        m = d[s]
c = []
for i in d:
    if d[i]==m:
        c.append(i)
c.sort()
for x in c:
    print(x)

n = int(input())
s = [input() for _ in range(n)]
count = {}

for word in s:
    if word not in count:
        count[word] = 1
    else:
        count[word] += 1

max_count = max(list(count.values()))
ans = []
for item in count.items():
    (key, value) = item
    if value == max_count:
        ans.append(key)

ans = sorted(ans)
for w in ans:
    print(w)

n = int(input())
L = list(input() for _ in range(n))
D = dict.fromkeys(set(L),0)

for l in L:
  D[l] += 1

m = max(D.values())
SD = sorted(D.items(), key=lambda x:x[0])

for k, v in SD:
  if v == m:
    print(k)

N = int(input())
dic, rst = {}, []
for i in range(N):
    s = input()
    if not s in dic:
        dic[s] = 1
    else:
        dic[s] += 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

q=int(input())
dic={}
for i in range(q):
    s=input()
    if not s in dic:
        dic[s]=1
    else:
        dic[s]+=1
max_val=max(dic.values())
a=sorted([i for i, k in list(dic.items()) if k == max_val])
for i in a:
    print(i)


n = int(input())
s = [input() for _ in range(n)]
ans = []
d = {}
for i in s:
    try: d[i] += 1
    except KeyError: d[i] = 1
mx = 0
for value in list(d.values()):
    if value > mx: mx = value
for key, value in list(d.items()):
    if value == mx:
        ans.append(key)
for v in sorted(ans):
    print(v)


from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
m = c.most_common()[0][1]
k = list(c.keys())
v = list(c.values())

l = []
for i in range(len(c)):
  if v[i] == m:
    l.append(k[i])

l.sort()
    
print(*l,sep="\n")

# C
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
countS = Counter(S)
maxS = max(countS.values())
ans = []
for key,value in list(countS.items()):
  if value == maxS:
    ans.append(key)

for a in sorted(ans):
  print(a)


n = int(input())
S = dict()
for i in range(n):
    s = input()
    if s in S:  S[s] += 1
    else:  S[s] = 1
ans = []
cnt = 0
for k,v in S.items():
    if v >= cnt:
        if v > cnt:  ans = []
        ans.append(k)
        cnt = v
print(*sorted(ans), sep='\n')


N = int(input())
A = {}
for i in range(N):
  s = input()
  if s in A:
    A[s] += 1
  else:
    A[s] = 1
s_max = max(A.values())
for j in sorted(k for k in A if A[k] == s_max):
  print(j)

def sovle():
    N = int(input())

    d = {}
    max = []
    max_count = 0
    for i in range(N):
        s = input()
        if s in d:
            d[s] += 1
        else:
            d[s] = 1
    
        if max_count < d[s]:
            max = [s]
            max_count=d[s]
        elif max_count == d[s]:
            max.append(s)
    
    max.sort()

    for i in max:
        print(i)
    
sovle()

N = int(input())
S = [input() for _ in range(N)]

# cnts = {key: S.count(key) for key in S}
cnts = {key: 0 for key in S}
for key in S:
  cnts[key] += 1

max_cnt = max(cnts.values())

ans = [k for k, v in cnts.items() if v == max_cnt]
ans.sort()

print(*ans, sep='\n')

import collections
n = int(input())
l = []
for i in range(n):
  l.append(input())
c = collections.Counter(l)
m = max(c.values())
chars = [key for key, value in c.items() if value == m]
chars.sort()
for s in chars:
  print(s)

from collections import Counter

n = int(input())
S = [input() for _ in range(n)]
C = Counter(S)
C_most = C.most_common()

ans = []
for key, val in C_most:
    if val == C_most[0][1]:
        ans.append(key)
    else:
        break
        
print(*sorted(ans), sep='\n')

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    D = defaultdict(int)
    for i in range(N):
        D[input().rstrip()]+=1
    D = D.items()
    D = sorted(D, key = lambda x:x[0])
    D = sorted(D, key = lambda x:x[1], reverse = True)
    num = D[0][1]
    
    for key, n in D:
        if n != num:
            return
        print(key)
    
def __starting_point():
    main()
__starting_point()

N = int(input())
dic = {}
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

N = int(input())
dic = {}
max_count = 1

for i in range(N):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
        if max_count < dic[s]:
            max_count = dic[s]

ans_lis = []

for i, j in dic.items():
    if j == max_count:
        ans_lis.append(i)

ans_lis.sort()

for i in ans_lis:
    print(i)

import numpy as np
N, = map(int, input().split())
dic = {}
for i in range(N):
  x = input()
  if x in dic:
    dic[x]+=1
  else:
    dic[x]=1
c=max(dic.values())
re =[]
for i in dic:
  if dic[i]==c:
    re+=[i]
re.sort()
for i in re:
  print(i)

N = int(input())

dct = {}

for i in range(N):
    s = input()
    if not s in dct:
        dct[s] = 1

    else:
        dct[s] +=  1
    
m = max(dct.values())
for s in sorted(k for k in dct if dct[k] == m):
    print(s)

import collections
N=int(input())
s=[str(input()) for i in range(N)]
c=collections.Counter(s)
maximum =max(c.values()) 
max_c_list = sorted(key for key,value in c.items() if value == maximum)
for s in max_c_list:
  print(s)

n = int(input())
a = {}
for i in range(n):
    s = input()
    if s not in a:
        a.update({s: 0})
    else:
        temp = a[s] + 1
        a.update({s:temp})
max_val = max(list(a.values()))
b = []
for key in a:
    if a[key] == max_val:
        b.append(key)
b.sort()
print(*b, sep='\n')

n = int(input())
count_dict = {}
for i in range(n):
    i = input()
    if i in count_dict.keys():
        count_dict[i] +=1
    else:
        count_dict[i] = 0
max_value = max(count_dict.values())
for key,value in sorted(count_dict.items()):
    if value == max_value:
        print(key)

# coding: utf-8
from collections import defaultdict


def main():
    N = int(input())
    dic = defaultdict(int)
    max_p = 0

    for i in range(N):
        dic[input()] += 1

    d = dict(dic)
    l = []

    for key, value in list(d.items()):
        l.append([key, value])
        if max_p < value: max_p = value
    
    l.sort(key=lambda x: (-x[1], x[0]), reverse=False)

    for i, j in l:
        if j == max_p:
            print(i)
        else:
            break


def __starting_point():
    main()

__starting_point()

import collections
N=int(input())
L=[]
for i in range(N):
  L.append(input())
C=collections.Counter(L)
Max=C.most_common()[0][1]
l = [i[0] for i in C.items() if i[1] == Max]
print(*sorted(l),sep='\n')



import collections

n = int(input())
s = [input() for _ in range(n)]

c = collections.Counter(s)
sorted_c = c.most_common()
max = sorted_c[0][1]
dict_c = []
for i in range(len(sorted_c)):
    if sorted_c[i][1] == max:
        dict_c.append(sorted_c[i][0])
    else:
        break

dict_c.sort()
for i in range(len(dict_c)):
    print((dict_c[i]))


N = int(input())
dic,rst = {}, []
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

N = int(input())
dic, lis = {}, []
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

M = max(dic.values())

for s in dic.keys():
    if dic[s] == M:
        lis.append(s)
ans = sorted(lis)
for s in ans:
    print(s)

N = int(input())
dic, rst = {}, []
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

N = int(input())
dic = {}
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]

import collections
def resolve():
    n = int(input())
    s = [input() for _ in range(n)]
    c = collections.Counter(s)
    max_count = c.most_common()[0][1]
    ans = [i[0] for i in c.items() if i[1]==max_count]
    for i in sorted(ans): print(i)
resolve()

from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

cnts = Counter(S)
max_l = max(cnts.values())

ans = [s for s, c in cnts.items() if c == max_l]
ans.sort()

print(*ans, sep='\n')

n = int(input())

cnt = {}
for i in range(n):
    s = input()
    if s in cnt:
        cnt[s] += 1
    else:
        cnt[s] = 1

res = []

maks = max(list(cnt.items()), key=lambda x : x[1])
for item in list(cnt.items()):
    if item[1] == maks[1]:
        res.append(item[0])

res.sort()
for s in res:
    print(s)



N = int(input())
S = [input() for _ in range(N)]
dic = {}
for i in range(N):
    if S[i] not in list(dic.keys()):
        dic[S[i]] = 1
    else:
        dic[S[i]] += 1

maxI = max(dic.values())
ans = []

for keys in list(dic.keys()):
    if dic[keys] == maxI:
        ans.append(keys)

ans.sort()

for i in ans:
    print(i)


n=int(input())

l={}
a=0

for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l[s]=1
    if a<l[s]:
        a=l[s]
ans=[]

for i in list(l.keys()):
    if l[i]==a:
        ans.append(i)

ans.sort()

for j in ans:
    print(j)


N = int(input())
dic = {}
for i in range(N):
    s = str(input())
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

S = sorted(dic.values())
t = S[-1]

X = []
for key in dic:
    if dic[key] == t:
        X.append(key)
x = sorted(X)

for i in range(len(X)):
    print(x[i])

N = int(input())
dic, rst = {}, []
for i in range(N):
    key = input()
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1
max_val = max(dic.values())
rst = [ key for key, value in dic.items() if value == max_val ]
[ print(i) for i in sorted(rst) ]

n = int(input())
s = [input() for i in range(n)]
dic = {}
for i in range(n):
    if s[i] in dic.keys():
        dic[s[i]] += 1
    else:
        dic[s[i]] = 1
max1 = max(dic.values())
ans = []
for keys in dic.keys():
    if dic[keys] == max1:
        ans.append(keys)
ans.sort()
for i in ans:
    print(i)

import collections
n = int(input())
ans = list(input() for i in range(n))
ans = collections.Counter(ans)
m = max(ans.values())
keys = [k for k, v in ans.items() if v == m]
[print(j) for j in sorted(keys)]

import collections
n = int(input())
names = [input() for _ in range(n)]
c = collections.Counter(names)
maxv = max(c.values())
ans = []
for i in c.items():
    if i[1] == maxv:
        ans.append(i[0])
ans = sorted(ans)
for i in ans:
    print(i)

n = int(input())

dic = {}

for x in range(n):
    a = input()
    dic.setdefault(a,0)
    dic[a] += 1

dic2 = sorted(list(dic.items()),key=lambda x:x[1],reverse=True)

max_word = [k for k,v in dic2 if v == dic2[0][1] ]

max_word.sort()

for x in max_word:
    print(x)


N = int(input())
S = [input() for _ in range(N)]
S.sort()

res = 0
cnt = 1
for i in range(N-1):
    if S[i] == S[i+1]:
        cnt+=1
    else:
        res = max(res,cnt)
        cnt = 1

res = max(res,cnt)

cnt = 1
ans = []
for i in range(N-1):
    if S[i] == S[i+1]:
        cnt+=1
    else:
        if res == cnt:
            ans.append(S[i])
        cnt = 1

if cnt == res:
    ans.append(S[i+1])

for i in range(len(ans)):
    print((ans[i]))