peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
s = ['.'] * n
for i in range(n):
    s[i] = str(input())

dict = {}

for i in range(n):
    if s[i] in dict:
        dict[s[i]] += 1
    else:
        dict[s[i]] = 1
        
m = max(dict.values())

keys = [k for k, v in dict.items() if v == m]
for i in range(len(keys)):
    print(keys[i])
import collections
n = int(input())
s = [input() for i in range(n)]
p = collections.Counter(s)
res = sorted(p.items(), key=lambda x: x[1],reverse = True)

keys = []
if(len(s) == len(set(s))):
  print(sorted(s))
  
#keys = [i for i,m in p.items() if m == p.values()]
for i,m in res:
  if(m == max(p.values())):
    keys.append(i)
  else:
    break
keys=sorted(keys)
for i in range(len(keys)):
  print(keys[i])
from collections import Counter 
num = input()
ins = list()
aa = list()
qc = 0
for abhsa in range(0, int(num)):
  ins.append(input())
cnt = Counter(ins)
nums = cnt.most_common()
res = nums[0][0]
values, counts = zip(*cnt.most_common())
aa.append(values[0])
for haha in counts:
  aqc = qc + 1
  if int(len(counts) - int("1")) >= aqc:
    if counts[qc] == counts[aqc]:
      aa.append(values[aqc])
      qc += 1
print("\n".join(aa))
import collections

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

c = collections.Counter(l)

L = c.most_common()

values, counts = zip(*c.most_common())

A = list(values)
B = list(counts)

b = B.count(B[0])

a = A[0:b + 1]
from collections import Counter

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

c = Counter(ss)

max_count = max(c.values())
for k, v in c.items():
  if v == max_count:
    print(k)
from collections import Counter
n = int(input())
lst = [input() for i in range(n)]
c = Counter(lst)
c2 = c.most_common()
m = c2[0][1]
for i in c2:
  if i[1] == m:
    print(i[0])
n = int(input())
vote = []
for i in range(0,n):
  vote.append(input())

poll = list(set(vote))
dict = {}
for i in poll:
  dict[i] = vote.count(i)

highest = max(dict.values())
top_element = poll.count(highest)

if top_element != 1:
  for key, value in dict.items():
    if highest == value:
        print(key)
else:
  for key, value in dict.items():
    if highest == value:
        print(key)
n = int(input())
s = [input() for i in range(n)]

s_list = list(set(s))
s_dict = {}
for i in range(len(s_list)):
    s_dict[s_list[i]] = 0

for i in range(len(s)):
    s_dict[s[i]] += 1

s_dict = dict(sorted(s_dict.items(), key=lambda x: (-x[1], x[0])))

max_kv_list = [kv[0] for kv in s_dict.items() if kv[1] == max(s_dict.values())]
print(*max_kv_list, sep="\n")
import collections

N = int(input())
A = []
for n in range(N):
    A.append(input())
A.sort()
A = collections.Counter(A)
res = 0
for k, v in A.items():
    if res < v:
        res = v
for k, v in A.items():
    if res <= v:
        print(k)
n = int(input())
s = [input() for _ in range(n)]
ans = {}
count = []
max_list =[]
for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count):
        max_list.append(s[i])

for item in set(max_list):
    print(item)
from collections import Counter
n=int(input())
mylist=[]
for i in range(n):
    s=input()
    mylist.append(s)
mylist.sort()
#print(mylist)
c=Counter(mylist)

max=sum(x==max(mylist) for x in mylist)
#print(max)
for word,i in c.most_common():
    #print(word,i)
    if i==max:
        print(word)
n = int(input())
b = {}
for i in range(n):
    temp = input()
    if temp not in b:
        b[temp] = 1
    else:
        b[temp] += 1

list1 = sorted(b.items(), key=lambda x: x[1])
list1.reverse()

a = 0
list2=[]
while a<len(list1) and list1[0][1] == list1[a][1]:
    list2.append(list1[a][0])
    list2.sort()
    a += 1

print(list2)
import collections
N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
m = max(c.values())
for k, v in c.items():
    if m == v:
        print(k)
import collections
import numpy as np
n = int(input())
S = [[0] * 2 * 10 * 5] * n


for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]
for k,v in c.items():
    if tmp != v:
        break
    tmp = v
    print(k)
N = int(input())
S = list()
for i in range(N):
    S.append(str(input()))
 
import collections
 
c = collections.Counter(S)
C = list(c.keys())
 
for i in range(0,len(C)):
    print(C[i])
n = int(input())
d = {}
ans = []
for i in range(n):
  s = input()
  if s not in d:
    d[s] = 1
  else:
    d[s] += 1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d = list(d.items())
score = d[-1][1]
for i in range(len(d)):
  if score == d[i][1]:
    ans.append(d[i][0])
ans.sort()
for i in range(len(ans)):
  print(ans[i])
import collections

N = int(input())
S = []
#N = 7
#S = ['beat', 'vet', 'beet', 'bed', 'vet', 'bet', 'beet']

for n in range(N):
    s = input()
    S.append(s)

S = sorted(S)

c = collections.Counter(S)

m = max(c.values())

chars = [key for key, value in c.items() if value == m]
chars = "\n".join(chars)
print(chars)
n = int(input())
S = []
for _ in range(n):
    S.append(input())

S.sort()
a = S[0]
c = 0
moji = []

for i in S:
    if a == i:
        c += 1
        continue
    else:
        moji.append([c,a])
        a = i
        c = 1
if c > 0:
    moji.append([c,a])

moji.sort(reverse=True)
maxc = moji[0][0]
for j in moji:
    if j[0] < maxc: break
    print (j[1])
import collections
N = int(input())
S = [input() for _ in range(N)]
v, c = zip(*collections.Counter(S).most_common())
n = c.count(c[0])
print('\n'.join(sorted(v)[:n]))
import collections
import sys
N = int(input())
S = [input() for _ in range(N)]



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

for i in range(len(c.most_common())):
    if i == 0:
        print(c.most_common()[0][0])
    
    if i != 0:
        if (c.most_common()[i-1][1]) == (c.most_common()[i][1]):
            ans.append(((c.most_common()[i][0])))
        else:
            break
ans.sort()

for i in ans:
    print(i)
n = int(input())
dic = {}
maxim = 0
for i in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
        if dic[s] > maxim:
            maxim = dic[s]
        
dic2 = sorted(dic.items(), key=lambda x:x[1], reverse=True)
dic3 = sorted(dic2, key=lambda x:x[0])

for i in dic3:
    if i[1] == maxim:
        print(i[0])
import collections
S_print = []
N=int(input())
S=[input() for i in range(N)]
S = collections.Counter(S)

S_common = S.most_common()
#print(S_common)

for i in range(len(S_common)):
	if S_common[0][1] == S_common[i][1]:
		S_print.append(S_common[i][0])

for i in range(len(sorted(S_print))):
	print(S_print[i])
import collections
N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
C=collections.Counter(S).most_common()
for i in range(len(C)):
  print(C[i][0])
import collections

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

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

S.sort()
counter = collections.Counter(S)
common = counter.most_common()


if (len(common) == 1):
    print(common[0][0])
else:
    print(common[0][0])
    tmp = common[0][1]

    for i in range(1, len(common)):
        if (common[i][1] == tmp):
            print(common[i][0])
n = int(input())

dic = {}
for _ in range(n):

    s =input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s]=1

maxdic = max(dic.values())

ans = [i for i in dic if dic[i]==maxdic]
print('\n'.join(ans))
N = int(input())
names = [input() for _ in range(N)]
ln = []
for i in names:
    if names.count(i) > 1:
        ln.append(i)
for ans in set(ln):
    print(ans)
import collections
N=int(input())
a=[]
for i in range(N):
    a.append(input())
b=collections.Counter(a)
v=list(b.keys())
for i in range(len(v)):
    print(v[i])
N = int(input())

slist = [(input()) for i in range(N)]

sdict = {}

for s in slist:
    if s in sdict:
        sdict[s] += 1
    else:
        sdict[s] = 1


sdict = {k: v for k, v in sorted(sdict.items(), key=lambda x: x[1], reverse=True)}



maxnum = -1

rlist = []

for k, v in sdict.items():
    maxnum = v
    break

for k, v in sdict.items():
    if v == maxnum:
        rlist.append(k)
    if v < maxnum:
        break

rlist.sort(reverse=False)

for r in rlist:
    print(r)
from collections import Counter

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

c = Counter(s)
ans_number = c.most_common()[0][1]

s_max = []
for i in range(len(c)):
  if c.most_common()[i][1] == ans_number:
    s_max.append(c.most_common()[i][0])
  else:
    break;

for a in s_max:
  print(a)
a=int(input())
name=[]
cnt=[0]*a
for i in range(a):
    s=input()
    if not s in name:
        name.append(s)
        cnt[i]+=1
    else:
        cnt[name.index(s)] +=1

m=max(cnt)

for a,b in zip(cnt,name):
    if a==m:
        print(b)
n = int(input())
a = dict()

for i in range(n): #辞書型でカウント
  s = input()
  a.setdefault(s, 0)
  a[s] += 1
  
ans = []
mx = 0
for key, value in a.items(): #最大値のものをリストに入れる
  if mx < value:
    mx = value
    ans = [key]
  elif mx == value:
    ans.append(key)

for i in ans:
  print(i)
n = int(input())
s = []
for i in range(n):
  s.append(input())

words = []
cnt = dict()
for i in range(n):
  if s[i] not in words:
    words.append(s[i])
    cnt[s[i]] = 1
  else:
    cnt[s[i]] += 1

cnt_sorted = sorted(cnt.items(), key=lambda x:x[1], reverse=True)
for j in range(len(cnt_sorted)):
  if cnt_sorted[j][1] == cnt_sorted[0][1]:
    print(cnt_sorted[j][0])
  else:
    break
n = int(input())
list_a = []

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

d = {}
for i in list_a:
  if i in d:
    d[i] = d[i] + 1
  else:
    d[i] = 1

key = [k for k, v in d.items() if v == d[max(d)]]
for i in key:
  print(i)
import collections
n= int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
l = [i for i,v in c.items() if v == max(c.values())]
for j in l:
    print(j)
import collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
#     S = sorted(list(map(str, input().split())))
#     a a a b c d d d e f
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
#     print(c[-1])
    ans = []
    for i in c:
        if (i[1]==maxi):
#             print(c[i][0],end="")
            ans.append(i[0])
    ans = '\n'.join(ans)
#     print(ans,end="\n")
    print(ans)
main()
import collections
n = int(input())
S = [input() for i in range(n)]
c = collections.Counter(S)
li = c.most_common()
M = li[0][1]
for x in li:
    if x[1] == M:
        print(x[0])
    else:
        break
n=int(input())
l=[input() for i in range(n)]
import collections
c=collections.Counter(l)
ll=c.most_common()
tmp=ll[0][1]
ans=[]
for i,j in ll:
    if tmp==j:
        ans.append(i)
    else:
        ans.sort()
        print('\n'.join(map(str,ans)))
        print(1)
        break
ans.sort()
print('\n'.join(map(str,ans)))
N = int(input())
s = [input() for i in range(N)]
import collections
s1 = sorted(s)
 
c = collections.Counter(s1)
s2 = c.most_common()
 
#print(s2)
a = 0
for i in range(len(s2)):
    if s2[0][1] == s2[i][1]:
        a = a + 1
s3 = []
 
for i in range(a):
    s3.append(s2[i][0])
for i in range(a):
    print(s3[i])
a = int(input())
b = [input() for i in range(a)]

q = sorted(set(b))
e = [b.count(k) for k in q]

r = []
t = max(e)
for l, p in zip(sorted(b), e):
  if p == t:
    r.append(l)

for h in r:
  print(h)
import collections
N=int(input())
a=[input() for i in range(N)]
a=collections.Counter(a)
values, counts = zip(*a.most_common())
values=sorted(values)
for i in range(len(values)):
    print(values[i])
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S)
ss = list(s)

count = 0 #多く出現する要素の個数を調べる
max = 0
for i in ss:
    if s[i] > max:
        count = 1
        max = s[i]
    elif s[i] == max:
        count += 1

for i in range(count):
	print(s.most_common()[i][0])
N = int(input())
S = [input() for _ in range(N)]

hash = {}
for i in range(N):
    if S[i] in hash:
        hash[S[i]] += 1
    else:
        hash[S[i]] = 1

max_value = max(hash.values())

result = {}
for i in hash.keys():
    if hash[i] == max_value:
        result[hash[i]] = True

for key in sorted(result.keys()):
    print(key)
import collections

n = int(input())
list = []
for x in range(n):
    s = input()
    list.append(s)
c = collections.Counter(list)
mc = c.most_common()
max = mc[0][1]
anslist = []
for val in mc:
    if max == val[1]: anslist.append(val[0])
    else: break
anslist.sort
for x in anslist:
    print(x)
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(list(s))
print(c.most_common()[0][0])
N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(i)
	elif max < v:
		results = [i]
		max = v
        
for i in results:
	print(i)
import collections
import itertools

a = int(input())

s = [input() for i in range(a)]

counter = collections.Counter(s)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)

print(*(k for k, v in it))
d = {}
N = int(input())

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

sd = sorted(d.items())

for i in range(len(sd)):
    if sd[i][1] == max(d.values()):
        print(sd[i][0])
    else:
        exit()
N=int(input())
Sarr1=[]
Sarr2=[]
for _ in range(N):
    s=input()
    if Sarr1.count(s)==0:
        Sarr1.append(s)
        Sarr2.append(0)
    if Sarr1.count(s)>0:
        i =Sarr1.index(s)
        Sarr2[i]+=1
ans=[]
for i in range(len(Sarr2)):
    if Sarr2[i]==max(Sarr2):
        ans.append(Sarr1[i])
    else:
        pass
FA=sorted(ans)
print(FA)
n = int(input())
dic = {}
lis = []
lis2 = []

for i in range(n):
  moji = input()
  if moji not in dic:
    dic[moji] = 0
  dic[moji] += 1
  
for i in sorted(dic.items(), key=lambda x:x[1]):
    lis.append(i)
  
lis.reverse()

for j in lis:
  if lis[0][1] == j[1]:
    lis2.append(j[0])
  else:
    break
    
for i in range(len(lis2)):
  print(lis2[i])
n=int(input())
s=[input() for _ in range(n)]



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

ans = [k for k,v in count.items() if v == max(count.values())]
for i in range(len(ans)):
    print(ans[i])
n = int(input())
S = [ input() for _ in range(n) ]

import collections

c = collections.Counter(S)

ls_ans = []
ls_ans.append( c.most_common()[0][0] )

a = c.most_common()[0][1]
for i in range(1,len(c)):
    if c.most_common()[i][1]==a:
        ls_ans.append(c.most_common()[i][0])
    else:
        ans = sorted(ls_ans)
        print("\n".join(ans))
        exit()
import collections
N = int(input())
L =  list(str(input()) for i in range(N))
c = collections.Counter(L)
# print(c)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
# print(max_k_list)
for i in max_k_list:
    print(i)
# -*- coding: utf-8 -*-
N = int(input())
s = []
c = []
d = []
for i in range(N):
    S = input()
    s.append(S)
for i in range(N):
    c.append(s.count(s[i]))
for i in range(N):
    if max(c) == c[i]:
        d.append(s[i])
d = set(d)
d = list(d)
d.sort(reverse = True)
for i in range(len(d)):
    print(list(d)[i])
# N枚の投票用紙
N = int(input())

s = {}
for _ in range(N):
    tmp = input()
    try:
        if s[tmp]:
            s[tmp] +=1
    except:
        s[tmp] = 1
    
#print(s)
max_kv_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]
#print(max_kv_list)

for tmp in max_kv_list:
    print(tmp)
n = int(input())
vote = []

for i in range(0, n):
    vote.append(str(input()))

most = dict()
for i in vote:
    if i not in most:
        most.update({
            i : 1
        })
    else:
        most[i] += 1

best = most[max(most)]

ans = []
for i in most:
    if most[i] == best:
        ans.append(i)

ans.sort()
for i in ans:
    print(i)
N = int(input())

s = [input() for i in range(N)]

print(list(set(s)))
from sys import stdin
n = int(stdin.readline().rstrip())
from statistics import mode
l = list(map(str, stdin.readline().rstrip().split()))
print(mode(l))
from collections import Counter
n = int(input())
#li = ['apple', 'orange', 'apple', 'banana', 'grape','orange']
li = []
for i in range(n):
    li.append(input())

#print(li)
#出現回数がもっとも多いタプルを返す（でもこれだと同一の場合１つしか出てこない...）
dic = Counter(li)
#print(dic.most_common())
#print(max(dic.values()))
max = max(dic.values())

for k,v in dic.items():
    if(v == max):    
        print(k)
from collections import Counter

def main():
    n = int(input())
    s = [input() for _ in range(n)]
    c = Counter(s)
    l = []
    max = 0
    for k, n in c.most_common():
        if n >= max:
            max = n
            l.append(k)
    l = l[::-1]
    [print(i) for i in l]



if __name__ == "__main__":
    main()
from collections import Counter
n = int(input())
s = sorted(list(input() for _ in range(n)))
s2 = dict(Counter(s))
mx = max(s2.values())
vl = list(s2.values())
word = list(s2.keys())
for i in range(len(word)):
    if mx == vl[i] :
        print(word[i])
import collections

n = int(input())
S = [[0] * 2 * 10 * 5] * n
l = []

for i in range(n):
    S[i] = input()

c = collections.Counter(S)
tmp = c[max(c)]
i = 0
for k,v in c.items():
    if tmp != v:
        if i == 0:
            l.append(k)    
        break
    tmp = v
    i = 1
    l.append(k)



l = sorted(l)
for i in l:
    print(i)
N = int(input())

Sdict = dict()
max = 0
for _ in range(N):
    s = input()
    if s in Sdict:
        Sdict[s] += 1
    else:
        Sdict[s] = 0
    
maxi = 0
lis = []
for k,v in Sdict.items():
    if v > maxi:
        lis = [k]
        maxi = v
    if v == maxi:
        lis.append(k)
lis.sort()
for k in lis:
    print(k)
N = int(input())
lists = []
for n in range(N):
    s = input()
    lists.append(s)
from collections import Counter
counter = Counter(lists)
#print(counter)
anslist = sorted(counter.items(), key = lambda x:x[1])
anslist.reverse()
#print(anslist)
num = anslist[0][1]
len = len(anslist)
#print(num)
for n in range(len):
    if anslist[n][1] == num:
        print(anslist[n][0])
    else:
        exit()
from collections import Counter

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

c = Counter(s)
c = c.most_common()
c.sort()
ans_number = c[0][1]

for i in range(len(c)):
  if c[i][1] == ans_number:
    print(c[i][0])
n=int(input())

d={}
for i in range(n):
  s=input()
  if(s in d):
    d[s]+=1
  else:
    d[s]=1
    
ma=max(d.values())
for i in sorted(d):
  if(d[i]==ma):
    print(d[i])
from collections import Counter,deque
n=int(input())
s=Counter([input() for i in range(n)])
l=deque([])
for i in s:
  l.append(i)
  if s[l[0]]<s[i]:
    l.popleft()
  elif s[l[0]]>s[i]:
    l.pop()
l=sorted(list(l))
for i in l:
  print(i)
import collections
N = int(input())
S = sorted([input() for n in range(N)])

cnt = collections.Counter(S)
cnt = dict(sorted(cnt.items(), key=lambda x:x[1], reverse=True))
m = max(cnt.values())

for k, v in cnt.items():
    if v == m:
        print(k)
    else:
        break
import collections

n = int(input())
List = [input() for i in range(n)]
res = []

c = collections.Counter(List)

leng = len(c)

res.append(c.most_common()[0][0])
for i in range(1, leng):
    if c.most_common()[i][1] >= c.most_common()[i-1][1]:
        res.append(c.most_common()[i][0])
    else:
        break

res = sorted(res)
n = int(input())

poll = {}

for i in range(n):
    name = input()
    max_val = 1
    if name not in poll:
        poll[name] = 1
    else:
        poll[name] += 1
        max_val = max(poll[name], max_val)

winner = []

for name, vote in poll.items():
    if vote == max_val:
        winner.append(name)
        
winner.sort()
for w in winner:
    print(w)
import collections

N = int(input())
a = []
for i in range(N):
  a.append(str(input()))
a = collections.Counter(a)
b = max(a.values())
max_k_list = [kv[0] for kv in a.items() if kv[1] == b]
for i in max_k_list:
  print(i)
n = int(input())
s= []

for _ in range(n):
    s.append(input())

s.sort()
n =set(s)
n=list(n)
print(n)

f = []

for i in range(len(n)):
    f.append([n[i],s.count(n[i])])

f.sort(reverse=True,key=lambda f:f[1])

max = f[0][0]
fl=[]
for i in range (len(f)):
    if f[i][1] == max:
        fl.append(f[i][0])
    else:
        break

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

for i in range(len(ansf)):
    print(ansf[i])
from collections import Counter
n = int(input())
lst = [input() for i in range(n)]

count = Counter(lst)
m = max(count.values())

for k, v in count.items():
  if v == m:
    print(k)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# input
N = int( input() )
S = list()
for ii in range(N):
    S.append( input() )
S.sort()

# calc 
import collections
C     = collections.Counter( S )

# output      
max_count = 0
for key in C.most_common():
    if( max_count <= key[1] ):
        max_count = key[1]
        print(key[0])
import collections
n = int(input())
si = []
for i in range(n):
    si.append(input())
ss = collections.Counter(si)
print(ss)

n_ma = max(ss.values())
ans = []
for i in ss.keys():
    if ss[i] == n_ma:
        ans.append(i)

ans.sort()
for i in range(len(ans)):
    print(ans[i])
n=int(input())
s_list=[input() for _ in range(n)]

import collections
s_counter = collections.Counter(s_list)

import sys
max_count = s_counter.most_common()[0][1]

s_list_keys = list(s_counter.keys())
s_list_values = list(s_counter.values())

list_ans = []

for i in range(len(s_list_keys)):
    if s_list_values[i] == max_count:
        list_ans.append(s_list_keys[i])
    else:
        sys.exit()

list_ans.sort()

for i in range(len(list_ans)):
    print(list_ans[i])
from collections import Counter

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

c=[i for i in max(Counter(s))]

for j in c:
	print(j)
import copy
import heapq

N = int(input())
A = [""] * N
for i in range(N):
	A[i] = input()
A.sort()

c, m = 1, [1, [A[0]]]
for i in range(1, N):
	if A[i - 1] == A[i]:
		c += 1
		if m[0] == c:
			m[1].append(A[i])
		elif m[0] < c:
			m[1].clear()
			m[1].append(A[i])
	else:
		if m[0] == c:
			m[1].append(A[i])
		elif m[0] < c:
			m[0] = c
		c = 1

for i in m[1]:
	print(i)
def main():
    N = int(input())
    S = []
    unique = set()
    for i in range(N):
        s = input()
        S.append(s)
        unique.add(s)
    
    count = []
    for u in unique:
        count.append(S.count(u))

    max_index = [i for i, x in enumerate(count) if x == max(count)]
    
    for index_ in max_index:
        print(S[index_])
    

if __name__ == '__main__':
    main()
n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[0])
print(b)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])
n =int(input())
s=[input() for i in range(n)]

s.sort()
s.append("ZZZZZZZZZZZZ")

ans = []
maxcnt = 0
cnt =0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    cnt += 1
  else:
    if maxcnt < cnt :
      maxcnt = cnt
      ans = []
      ans.append(s[i])
      cnt = 0
    elif maxcnt == cnt :
      ans.append(s[i])
      cnt = 0
for j in range(len(ans)):
  print(ans[j])
import collections

n = int(input())
s = []
l = [0]

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

s = collections.Counter(s)

for i in s.keys():
    if s[i] > l[0]:
        l.pop(0)
        l.append(s[i])

keys = [k for k, v in s.items() if v == l[0]]


for i in range(len(keys)):
    print(keys[i])
n = int(input())
s = sorted([input() for _ in range(n)])
dic = {s[0]:1}
for i in range(n-1):
    if s[i] == s[i+1]:
        dic[s[i]] += 1
    else:
        dic[s[i+1]] = 1
dic2 = sorted(dic.items(), key=lambda x:x[1], reverse=True)
ma = dic2[0][1]
for i, j in dic2:
    if j == ma:
        print(i)
import collections

n = int(input())
s = []
for i in range(n):
    s.append(input())
s.sort()
c = collections.Counter(s)
c_most = c.most_common()

i = 0
while (True):
    print(c_most[i][0])
    i += 1
    if i == len(c_most):
        break
    if c_most[i][1] != c_most[i - 1][1]:
        break
N = int(input())
S = []
maxnum = 0
maxyouso = []
for kai in range (N):
    S.append(input())
for num in S:
    if S.count(num) > maxnum:
        maxnum = S.count(num)
for num in S:
    if S.count(num) == maxnum:
        maxyouso.append(num)
maxysouso = set(maxyouso)
maxyouso.sort()
for j in maxyouso:
    print(j)