peterverebics/CodeNet_Python_118 huggingface dataset:
n=int(input())
a=[input() for i in range(n)]
 
from collections import Counter
c = Counter(a).most_common()
d=c[0][1]

keys = [k for k, v in c if v == d]
 
string = "\n".join(keys)
print(string)
import sys
import collections

N = int(input())
S = [str(input()) for i in range(N)]
S_jadge1 = [s for s in S if s.islower()]
# print(S_jadge1)
S_jadge2 = [s for s in S if 1 <= len(s) <= 10]
# print(S_jadge2)
if len(S) != len(S_jadge1):
    sys.exit()
if len(S) != len(S_jadge2):
    sys.exit()
if not 1 <= N <= 2*10*5:
    sys.exit()

c = collections.Counter(S)
max_val = max(c.values())
A = [key for key, value in c.items() if value == max_val]
A = sorted(A)
print('\n'.join(A))
# print(c.items())
from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)

# check
s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
max_s = [s[0] for s in s_counter.items() if s[1] == max]
for i in [s for s in S if s in max_s]:
    print(i)
import collections
import itertools
N=int(input())
S=[]
Snum=[]

for i in range(N):
    S.append(input())
print(S)
counted= collections.Counter(S)

ret = [letter for letter,count in counted.most_common() if count == counted.most_common()[0][1]]

ans=sorted(ret)
for i in ans:
    print(i)
import collections
N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
values, counts = zip(*c.most_common())
if len(values) == 1:
    print(values[0])
else:
    i = 0
    while counts[i] == counts[0]:
        print(values[i])
        i += 1
        if i == N:
            exit()
dic={}
max1=0
ans=[]
n=int(input())
for i in range(n):
    word=input()
    if word in dic:
        dic[word]+=1
    else:
        dic[word]=1

for k in dic.values():
    if k>max1:
        max1=k
print(max1)

for n,b in dic.items():
    print(n,b)
    if b==max1:
        ans.append(n)
sorted(ans)

for i in ans:
    print(i)
import collections
n = int(input())
s_list = []
for _ in range(n):
    i = input()
    s_list.append(i)
c = collections.Counter(s_list)

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

for i in range(len(counts)-1):
    if counts[i] == counts[i+1]:
        index += 1
    else:
        break

for j in range(index+1):
    print(values[j])
#標準入力からの値取得(N)
N = int(input())
#標準入力からの値取得(List)
S = []
for i in range(N):
  S.append(input())
#ループで廻しつつ要素数をカウントする
ans = {}
for cnt in S:
  if cnt in ans:
    ans[cnt] += 1
  else:
  	ans[cnt] = 1

max_v = max(ans.values())
for k, v in ans.items():
  if v == max_v:
    print(k)
import collections
N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
n = len(c)
max = c.most_common()[0][1]
for j in range(n):
  if c.most_common()[j][1] != max:
    break
ans = [c.most_common()[i][0] for i in range(j)]
ans.sort()
for i in range(j):
  print(ans[i])
def main():
    N = int(input())
    S = []
    for i in range(N):
        s = input()
        S.append(s)
    S.sort()
    tmp = {}
    m = 0
    for s in S:
        if s not in tmp.keys():
            tmp[s]=0
        else:
            tmp[s]+=1
        if m<tmp[s]:
            m = tmp[s]
    for key in tmp:
        val = tmp[key]
        if val == m:
            print(key)
main()
import collections
l=[]
n=int(input())
for i in range(n):
  l.append(input())
c=collections.Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]

for j in max_list:
  print(j)
import collections
 
n=int(input())
a=[]
for i in range(n):
    a.append(input())

c = collections.Counter(a)
naga=len(c)
ma=c.most_common()[0][1]
 
for i in range(naga):
    if c.most_common()[i][1]==ma:
        print(c.most_common()[i][0])
n = int(input())
S = [input() for _ in range(n)]
d = {}
m = 0
for s in S:
    if s in d:
        d[s] += 1
        m = max(m, d[s])
    else:
        d[s] = 1
        m = 1
sd = sorted(d.items(), key=lambda x: x[1], reverse=True)
ans = []
for k, v in sd:
    if v != m:
        break
    ans.append(k)
for a in sorted(ans):
    print(a)
N = int(input())
A = [str(input()) for i in range(N)]
A.sort()
B = list(set(A))
ans = [0 for _ in range(len(B))]
for i in range(len(B)):
  ans[i] = A.count(B[i])
i_max = [i for i, x in enumerate(ans) if(max(ans)==x)]

for i in range(len(i_max)):
  print(B[i_max[i]])
n=int(input())
s=[input() for x in range(n)]
l=list(set(s))
cnt=[0]*len(l)
for ss in l:
  for sss in s:
    if sss==ss:
      cnt[l.index(ss)]+=1
m=max(cnt)
ans=[]
for cc in cnt:
  if cc==m:
    ans.append(cnt.index(cc))
for aa in ans:
  print(l[aa])
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

for i in range(N-1):
    print(D[i][0])
    if len(D)==1:
        exit()
    elif D[i][1] == D[i+1][1]:
        continue
    else:
        exit()
print(D[N-1][0])
n = int(input())
data_list = [input() for i in range(n)]
data_list.sort()


data_set = set(data_list)
sorted_list = sorted(data_set)

count_list = [0] * len(sorted_list)

for i in range(len(sorted_list)):
    for j in range(len(data_list)):
        if sorted_list[i] == data_list[j]:
            count_list[i] +=1

max_indexes = [i for i, x in enumerate(count_list) if x == max(count_list)]

for i in range(len(max_indexes)):
    print(sorted_list[i])
N=input()
n=int(N)

p=[]
for i in range(n):
    p.append(input())

q=list(set(p))

maxi=0
big=[]

for i in range(len(q)):
    if maxi<p.count(q[i]):
        maxi=p.count(q[i])
        big.append(q[i])
        big.pop(0)
    if maxi==p.count(q[i]):
        big.append(q[i])
    else:
        continue
big.sort()
for i in range(len(big)):
    print(big[i])
N = int(input())

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

l = dic.items()
max = 0
for i in l:
    if i[1] > max:
        max = i[1]

result = []
for i in l:
    if i[1] == max:
        result.append(i[0])

result.sort()

for i in result:
    print(i)
N = int(input())

for_dict = {}
for _ in range(N):
    n = input()
    if n in for_dict:
        for_dict[n] += 1
    else:
        for_dict.setdefault(n, 1)

max_kv_list = [kv for kv in for_dict.items() if kv[1] == max(for_dict.values())]
print(max_kv_list)

slist = sorted(max_kv_list, key=lambda x: x[0])

for ele in slist:
    print(ele[0])
import sys
n = int(input())
a_dict = {}
max_val = 1
max_key_list = []
for s in sys.stdin:
  s = s.rstrip()
  if s not in a_dict:
    a_dict[s] = 1
    if max_val == 1:
      max_key_list.append(s)
  else:
    a_dict[s] += 1
    if a_dict[s] > max_val:
      max_val = a_dict[s]
      max_key_list = [s]
    else:
      max_key_list.append(s)
max_key_list.sort()
for s in max_key_list:
  print(s)
n = input()
n = int(n)
s = []
for i in range(n):
	temp = input()
	s.append(temp)

max_s = 0
m_str = []
for i in range(n):
	temp = s.count(s[i])
	#print(temp,s[i],m_str)
	if temp > max_s :
		#print("if")
		max_s = temp
		m_str = []
		m_str.append(s[i])
	elif temp == max_s :
		#print("elif")
		if not s[i] in m_str:
			#print("if not")
			m_str.append(s[i])
for ans in m_str:
	print(ans)
N = int(input())
l = []

for _ in range(N):
    s = str(input())
    l.append(s)

import collections
c = collections.Counter(l)

ml = [kv for kv in c.items() if kv[1] == max(c.values())]

for _ in range(len(ml)):
    print(ml[_][0])
import collections

n = int(input())
l = [input() for _ in [0] * n]

counted = collections.Counter(l)
print(counted)

# 最頻値を求める
m = max(counted.values())
print(m)

# 頻出数の文字を集める
chars = [key for key, value in counted.items()
             if value == m]

#chars = []
#for key, value in counted.items():
#    if value == m:
#        chars.append(key)

print(*sorted(chars),sep='\n')
n = int(input())
str_list = []

for count in range(n):
    str_list.append(input())
set_list = set(str_list)

max = 0
ans = []

for txt in set_list:
    count = str_list.count(txt)
    if(max < count):
        max = count
        ans.clear
        ans.append(txt)
    elif(max == count):
        ans.append(txt)

ans.sort()
for txt in ans:
    print(txt)
import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)
n=int(input())
s=sorted([input() for i in range(n)])
ct=0
tmp=1
for i in range(n-1):
    if s[i] ==s[i+1]:
        tmp+=1
    else:
        if tmp>ct:
            ct=tmp
        tmp=1
if tmp > ct:
    ct = tmp
    
tmp=1
for i in range(n-1):
    if s[i] ==s[i+1]:
        tmp+=1
        if tmp == ct:
            print(s[i])
    else:
        tmp=1
import collections

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

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

S.sort()
counter = collections.Counter(S)
common = counter.most_common()
# common.sort(key=lambda x: x[1], reverse=True)
# print(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])
import collections
N = int(input())
listA = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
print(c[0][0])
A = len(c)
for i in range(1,A):
    if max_number == c[i][1]:
        print(c[i][0])
    else:
        exit()
import collections
N = int(input())
A=[input() for i in range(N)]
c = collections.Counter(A)
values, counts = zip(*c.most_common())
k = max (counts)
l =counts.count(k)
V = []
for i in range(l):
  V.append(values[i])
sorted(V)
for j in range(len(V)):
  print(V[j])
N = int(input())
D = dict()
for _ in range(N):
    cand = input()
    if cand not in D:
        D[cand] = 1
    else:
        D[cand] += 1
mx = max(D.values())
A = sorted(D.items(), key=lambda x: -x[1])

for k, m in A:
    if m == mx:
        print(k)
    else:
        exit()
import collections
from collections import Counter
n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
max = c.most_common()[0][1]
list = []
for i in c.items():
    if i[1] == max:
        list.append(i[0])
for i in reversed(list):
    print(i)
N = int(input())
S = [0]*N
for i in range(N):
    S[i] = input()
A = {}
for s in S:
    if s not in A:
        A[s] = 1
    else:
        A[s] += 1

B = [(a, A[a]) for a in A]
# print(B)
B.sort(reverse=True, key=lambda x: x[1])
# print(B)
count = B[0][1]
for b in B:
    if b[1] == count:
        print(b[0])
print()

N = int(input())

dic = {}

for i in range(N):
	key = input()
	if key not in dic:
		dic[key] = 0
	else:
		dic[key] +=1

maxnum = max(dic.values())

keys = list(dic.keys())
for key in reversed(keys):
	if dic[key] == maxnum:
		print(key)
N = int(input())
word_count = {}
for i in range(N):
    word = input()
    if word not in word_count:
        word_count[word] = 1
    else:
        word_count[word] += 1

counts = [val for (key, val) in word_count.items()]
max_count = max(counts)
words = [key for (key, val) in word_count.items() if val == max_count]
for word in words:
    print(word)
n = int(input())
dic = {}
for i in range(n):
  elem = input()
  if not elem in dic:
    dic[elem] = 1
  else:
    dic[elem] += 1
max_ = max(dic.values())

for k, v in dic.items():
  if v == max_:
    print(k)
N=int(input())
d=dict()
A=[]
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
ma=max(d.values())
for i in d:
  if d[i]==ma:
    print(i)
import collections
a = int(input())
li1 = []

for i in range(a):
    li1.append(str(input()))

li1.sort()
c = collections.Counter(li1)

print(c.most_common()[0][0])
for i in range(1,len(c)):
    if( c.most_common()[0][1] == c.most_common()[i][1] ):
        print(c.most_common()[i][0])
N = int(input())
D = {}
for i in range(N):
  S = input()
  if S in D:
    D[S] += 1
  else:
    D[S] = 1
M = max(D)
L = []
for i in D:
  if D[i] == M:
    L.append(i)
L.sort()
for i in range(len(L)):
  print(L[i])
N = int(input())
l = []
for i in range(N):
  l.append(input())
l.sort()
s = set(l)
ss = list(s)
w = []
for i in range(len(ss)):
  w.append(l.count(ss[i]))
for i in range(len(w)):
  if max(w) == w[i]:
    print(ss[i])
from collections import Counter
N = (int)(input())
A = [input() for i in range(N)]

B = Counter(A)

max = [kv for kv in B.items() if kv[1] == max(B.values())]
# print([i[0] for i in max])
print("///")
for i in reversed(max):
    print(i[0])
n = int(input())
s = sorted([str(input()) for _ in range(n)])

S = set(s)
c_m = int(0)
l = []
ans = []

for i in range(len(S)):
    a = S.pop()
    c_i = int(s.count(a))
    if c_i >= c_m:
        c_m = c_i
        l.append([c_m, a])
        continue

l.sort(reverse = True)
for i in range(len(l)):
    if l[0][0] == l[i][0]:
        ans = l[i][1]
        print(ans)
n=int(input())
s=[input() for _ in range(n)]
s.sort()
s.append("X")
#print(s)
a=[]
count=[]
buf=1
for i in range(n):
    if s[i]==s[i+1]:
        buf+=1
    elif buf>1:
        a.append(s[i])
        count.append(buf)
        buf=1
#print(a)
#print(count)
for i in range(len(a)):
    if count[i]==max(count):
        print(a[i])
N = int(input())
dic = {}

for _ in range(N):
    S = input()
    if S in dic.keys():
        dic[S] += 1
    else:
        dic[S] = 1

dic = sorted(dic.items(), key=lambda x:x[1])

v = dic[-1][1]
ans = reversed(list(dic))



for a in ans:
    if a[1] == v:
        print(a[0])
import collections

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

cnt = collections.Counter(S)
max_cnt = max(cnt.values())

ans_list = []

for key, value in cnt.items():
    print(key, value)
    if value == max_cnt:
        ans_list.append(key)

print(*sorted(ans_list), sep='\n')
import sys
input = sys.stdin.readline
N = int(input())
S = []
for _ in range(N):
    s = input().replace("\n", "")
    S.append(s)
S.sort()
f = 0
tres = 0
res = [s[0]]
for i in range(1, N):
    if S[i] == S[i-1]:
        f += 1
    else:
        f = 0
    if f == tres:
        res.append(S[i])
    elif f > tres:
        tres = f
        res = [S[i]]

print("\n".join(map(str, res)))
n = int(input())
s = [input() for i in range(n)]
s.sort()
l = sorted(set(s))
ms = len(s) - len(l)
if ms == 0:
    print("\n".join(s))
    exit()

ans = 0
ans_l = []
for i in l:
    if ms >= -1:
      sc = s.count(i)
      if sc > ans:
        ans_l = [i]
        ans = sc
        ms -= sc
      elif sc == ans:
        ans_l.append(i)
        ms -= sc
    else:
      exit()
      
print("\n".join(ans_l))
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  print(k)
  maxv = v
n = int(input())
a_dict = {}
max_val = 1
max_key_list = []
for i in range(n):
  s = input()
  if s not in a_dict:
    a_dict[s] = 1
    if max_val == 1:
      max_key_list.append(s)
  else:
    a_dict[s] += 1
    if a_dict[s] > max_val:
      max_val = a_dict[s]
      max_key_list = [s]
    else:
      max_key_list.append(s)
max_key_list.sort()
for s in max_key_list:
  print(s)
n = int(input())
name = {}
for i in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort

for n in max_name:
    print(n)
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
print('\n'.join([ k for k , v in c.most_common()]))
from collections import Counter

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

lists = dics.most_common()
maxc = lists[0][1]

for word,cnt in lists:
	if maxc == cnt:
		print(word)
from collections import Counter

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


if __name__ == "__main__":
    main()
import collections

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

c=collections.Counter(S)

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

for l in max_s_list:
    print(l)
def main():
    N = int(input())
    S = [input() for i in range(N)]
    from collections import Counter
    c = Counter(S)
    cnt = c.most_common()[0][1]
    for s in c.most_common():
        # print(s)
        if s[1] == cnt:
            print(s[0])


if __name__ == '__main__':
    main()
import collections

N = int(input())
S = []
kaisuu = []
solution = []
index = 0

for i in range(N):
  tmp = input()
  S.append(tmp)
  
c = collections.Counter(S)

d = c.most_common()

max_ = d[0][1]

for i in range(len(d)):
  if d[i][1] == max_:
    solution.append(d[i][0])

for i in solution:
  print(i)
class atcoder:
    N=int(input())
    S=[input() for i in range(N)]
    S.sort()
    d={}
    for i in S:
        if i not in d:
            d[i]=1
        else:
            d[i]+=1
    ma=max(d.values())
    
    for i in d:
        if d[i]==ma:
            print(i)
        else:
            pass
N = int(input())

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

ds ={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
max = max(ds.values())

keys = [k for k,v in ds.items() if v == max]

print(keys)
n=int(input())
d={}
for i in range(n):
    s=input()
    try:
        if d[s]==1:
            d[s]+=1
    except:
        d[s]=1
l=[]
maxi=-1
for i in d:
    if d[i]>maxi:
        maxi=d[i]
for i in d:
    if d[i]==maxi:
        l.append(i)
l.sort()
for i in l:
    print(i)
from collections import defaultdict

N = int(input())
A = [input() for _ in range(N)]
A.sort()
d = defaultdict(int)
for a in A:
    d[a] += 1

l = sorted(d.items())
max_v = l[len(l)-1][1]

for k, v in l:
    if v == max_v:
        print(k)
    else:
        continue
from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)

# check
s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
for i in s_counter.items():
    if i[1] == max and i[0] not in printed_items:
        print(i[0])
        append(i[0])
n=int(input())
dic = {}
for i in range(n):
    a = input()
    if a in dic:
        dic[a] += 1
    else:
        dic[a]   = 1
maxa = max(dic.values())
ans = [x for x, y in dic.items() if y == maxa]
print(sorted(ans))
import collections
import itertools

n = int(input())
s = [0] * n
for i in range(n):
    s[i] = input()
s = sorted(s)
c = collections.Counter(s)
cc = c.most_common()

num = cc[0][1]
for i in cc:
    if i[1] == num:
        print(i[0])
N=int(input())
S=[]
for _ in range(N):
  S.append(input())
  
import collections

c=collections.Counter(S)
vl=list(c.values())
mv=max(vl)

ans=[]
for k, v in c.items():
  if v==mv:
    ans.append(k)
  else:
    break
ans.sort()
[print(a) for a in ans]
N=int(input())
s=sorted([input() for i in range(N)])
c=[]
max=0
def remove():
    s.remove(s[0])
def add(max):
    if s.count(s[0]) >= max:
        c.append([s[0],s.count(s[0])])
        max = s.count(s[0])
    return max
while len(s) > 0:
    max = add(max)
    remove()
for i in range(len(c)):
    print(c[i][0])
from collections import Counter
n = int(input())
S = [input() for _ in range(n)]

dictionary = dict(Counter(S))
ans = ["z" * 10] * n
i = 0
for k in dictionary.keys():
    if dictionary[k] == max(list(dictionary.values())):
        ans[i] = k
        i += 1

ans.sort()
print(ans)
for a in ans:
     if a == "z" * 10:
         break
     print(a)
from collections import Counter

n = int(input())

a = []
for i in range(n):
    s = input()
    a.append(s)

count = Counter(a)
tmp = []
for ss, ii in count.most_common():
    if ii > 1:
        tmp.append(ss)
tmp.sort()
for t in tmp:
    print(t)
import collections

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

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c.items():
  if value == max_num:
    d.append(key)
  else:
    break

for i in sorted(d):
  print(i)
N = int(input())
S = [input() for i in range(N)]
A = []
i = 1
ls = len(S)

S.sort()

while True:
  if ls > i:
    if S[0] == S[i - 1]:
      count = S.count(S[0])
    else:
      count = 0

    if count > i:
      A = [S[0]]
      i = count
    elif count == i:
      A = A + [S[0]]

    S[0:count] = []
    ls = len(S)
    
  else:
    break

for val in A:
	print(val)
import collections
N= int(input())
S = []
for _ in range(N):
    S.append(input())
    
c = collections.Counter(S)
print(c.most_common()[0][0])
n = int(input())
s = [input() for i in range(n)]
ans = []
out = []
word_list = list(set(s))

for i in word_list:
  ans.append([s.count(i), i])

ans.sort(reverse = True)

for j in ans:
  if j[0] == ans[0][0]:
    out.append(j[1])

out.sort(reverse = True)
for k in out:
  print(k)
from collections import Counter

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

c = Counter(s)
tmp = c.most_common()
ans = []

for i in range(len(tmp)):
    if tmp[i][1] != tmp[0][1]:
        break
    else:
        ans.append(tmp[i][0])

ans.sort()
print(ans[0])
N = int(input())
S = list()

for _ in range(N):
    S.append(input())
S_set = set(S)
S_dict = dict()
for s in S_set:
    S_dict[s] = 0

for val in S:
    S_dict[val] += 1
max_num = max(S_dict.values())
ans = list()
for k, v in S_dict.items():
    if v == max_num:
        ans.append(k)
sorted(ans)
for res in ans:
    for _ in range(max_num):
        print(res)
from collections import *
_,*a=map(lambda x:x.rstrip(), open(0))
a=Counter(a).most_common()
a=[i[0] for i in a if i[1]==a[0][1]]
print(*a,sep="\n")
from collections import Counter
import collections

N = int(input())
a = [input() for i in range(N)]



c = collections.Counter(a)

list = []

for i in range(0,len(c.most_common())-1):
    if(c.most_common()[i][1] == c.most_common()[0][1]):
        list.append(c.most_common()[i][0])

list.sort()
print(' \n'.join(map(str, list)))
import math


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


n = int(input())
s = [input() for i in range(n)]
# print(s)
s.sort()
# print(s)
ss = [i for i in s if s.count(i) > 1]
print(ss)
import sys
import collections

N = int(input())
S = []
for _ in range(N):
    S.append(input()) 
c = collections.Counter(S)
a = c.most_common()
s = c.most_common()[0][1]
ans = []
for i in a:
    if i[1] == s:
        print(i[0])
n = int(input())

s = {}
i = 0
while n > i:
    s_tmp = input()
    if s.get(s_tmp):
        s[s_tmp] += 1
    else:
        s.setdefault(s_tmp, 1)
    i += 1
    
max_d = max(s.values())

print(max_d)
n=int(input())
s=[input() for i in range(n)]
s.sort()
d=set()
cnt=0
for i in s:
  cnt=max(cnt,s.count(i))
  d.add(i)
for i in d:
  if s.count(i)==cnt:
    print(i)
n = int(input())

word_dict = {}

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

max_list = [kv[0] for kv in word_dict.items() if kv[1] == max(word_dict.values())]
sort_list = sorted(max_list)
for i in max_list:
    print(i)
from sys import stdin, setrecursionlimit


def main():
    n = int(stdin.readline())
    s = [stdin.readline()[:-1] for _ in range(n)]
    s.sort()
    s_set = set(s)
    summary = {}

    for key in s_set:
        summary[key] = 0

    m = 0
    for si in s:
        summary[si] += 1
        m = max(summary[si], m)

    for key in s_set:
        if summary[key] == m:
            print(key)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
from collections import *
n,*s=map(str,open(0).read().split())
s=Counter(s).most_common()
for a,i in s:
  if i==s[0][1]:
    print(a)
  else:
    break