peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
from collections import Counter

read = sys.stdin.read

N, *S = map(str, read().split())
s = Counter(S).most_common()
n = s[0][1]
answer = [i for i, j in s if j == n]
answer.sort()
print('\n'.join(answer))
counts = {}

for _ in range(int(input())):
    s = input()
    counts[s] = counts.get(s, 0) + 1

words = []
highest_count = 0
#print(counts)

for word, count in counts.items():
    if count > highest_count:
        highest_count = count
        words = [word]
    elif count == highest_count:
        words.append(word)
#print(words)
print("\n".join(sorted(words)))
# -*- coding: utf-8 -*-

n=int(input())  #数値入力 「N」だけの入力のとき
i=0
lst ={}
while i < n: 
    s = input()
    if s not in lst:
        lst[s]=1
    else:
        lst[s]+=1
    i+=1
maxi = max(lst.values())
res = []
for i,j in lst.items():
    if j == maxi:
       res.append(i) 
res.sort()
for i in res:
     print(i)
N = int(input())
S = [str(input()) for _ in range(N)]
#print(S)
dic={}
for i in range(N):
  if S[i] in dic.keys():
     dic[S[i]]+=1
  else:
     dic[S[i]]=1    
#print(dic)
sortedd = sorted(dic.items(), key=lambda x:x[1])
#print(sortedd)

maxc=sortedd[-1][1]
#maxc=max(dic.items())
#print(maxc)
#print(dic.keys())

sol=[]
for key in dic.keys():
  if dic[key] == maxc:
    sol+=[str(key)]
#print(sorted(sol))
for x in sorted(sol):
  print(x)
#  print(x+'\n')
n = int(input())
d = {}
for _ in range(n):
  s = input()
  if s in d: d[s] += 1
  else: d[s] = 1
  
t = max(d.values())
for x,y in sorted(d.items()):
  if y == t: print(x)
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
c.most_common()
ans = []
m = -1
for i, item in enumerate(c.most_common()):
    if i == 0:
        m = item[1]
        ans.append(item[0])
    elif item[1] == m:
        ans.append(item[0])
    else:
        break
ans.sort()
print(*ans, sep='\n')
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
S.sort()
s = Counter(S)
max_len = max([n for n in s.values()])
#print("------------------")
for a, b in s.items():
    if b == max_len:
        print(a)
import collections

N = int(input())
S = sorted([input() for i in range(N)])
slist = collections.Counter(S)

items = list(slist.keys())
numbers = list(slist.values())

maximum = max(numbers)

for i in range(len(numbers)):
    if numbers[i] == maximum:
        print(items[i])
N = int(input())
d = {}
for i in range(N):
  key = input()
  if key in d:
    d[key] += 1
  else:
    d[key] = 1
d_max = max(d.values())
l_max = [kv[0] for kv in d.items() if kv[1] == d_max]
l_max.sort()
for ch in l_max:
  print(ch)
N = int(input())
d = dict()
m = 0
for _ in range(N):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
    if d[s] > m:
        m = d[s]

sd = sorted(d.items(), reverse=True, key=lambda x:x[1])
ans = []
for k, v in sd:
    if v == m:
        ans.append(k)
    else:
        break

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

N = int(input())
S = [""] * N
for i in range(N):
    S[i] = input()

c = collections.Counter(S)
c_most_num = c.most_common()[0][1]
ans = []
for ci in c.most_common():
    if ci[1] == c_most_num:
        ans.append(ci[0])
ans.sort()

for a in ans:
    print(a)
import sys
N = int(input())

input = sys.stdin.readline
lis = {}
for i in range(N):
  s = input().rstrip()
  if s in lis:
    lis[s] += 1
  else:
    lis[s] = 1
lis2 = sorted(lis.items(), key=lambda x:x[1], reverse=True)
x = next(iter(lis2))
keys = []
for i in lis2:
  if i[1] == x[1]:
    keys.append(i[0])
ans = sorted(keys)
for i in ans:
  print(i)
from collections import Counter

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

counter = Counter(S)
maxv = max(counter.values())
ans = []
for k, v in counter.items():
    if v == maxv:
        ans.append(k)

ans.sort()

for s in ans:
    print(s)
import collections
n=int(input())
str_list=[input() for i in range(n)]
cal=collections.Counter(str_list)
cal=cal.most_common()
ans=cal[0][1]
answer=cal.sort()

for i in range(len(cal)):
    if cal[i][1]==ans:
        print(cal[i][0])
N = int(input())

dict = {}
strings = []
for i in range(N):
    x = input()
    if x in dict.keys():
        dict[x] += 1
    else:
        dict[x] = 1

maximum = 1
for i in dict:
    maximum = max(maximum,dict[i])

for word in dict:
    if dict[word] == maximum:
        strings.append(word)
strings.sort()
for word in strings:
    print(word)
#bA
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S) #出現回数をまとめた辞書型作成

maximum = max(s.values()) #
list = sorted(key for key,value in s.items() if value==maximum)
#sを利用して、出現回数が最大のものを辞書順に並べたリストを作成

for i in list:
    print(i)
n = int(input())
dic = {}
m = 0
for ind in range(n):
    word = input()
    if not word in dic.keys():
        dic[word] = 1
    else:
        dic[word] = dic[word] + 1
    m = max(m, dic[word])

l = []
for key in dic.keys():
    if dic[key] == m:
        l.append(key)
l.sort()
for elm in l:
    print(elm)
from collections import defaultdict

N = int(input())
S_dic = defaultdict(int)

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

m = max(S_dic.values())
max_S = [i[0] for i in S_dic.items() if i[1] == m ]
max_S.sort()
print("\n".join(max_S))
n = int(input())
l = [str(input()) for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

if max == 1:
  ans.append([l[n-1], 1])
      
for i in ans:
  if i[1] == max:
    print(i[0])
from collections import Counter
def check(n):
    d = Counter([input() for _ in range(n)])
    result = d.most_common()
    max_cnt = result[0][1]
    namelist = []
    for name, cnt in result:
        if max_cnt == cnt:
            namelist.append(name)
    for name in sorted(namelist):
        print(name)
    
n = int(input())
check(n)
n = int(input())
d = dict()
max_value = 0
for i in range(n):
  x = input()
  if x in d:
    d[x] += 1
  else:
    d[x] = 1
  max_value = max([max_value, d[x]])

d = sorted([(key, value) for key, value in d.items()], key = lambda x: x[0])
for key, value in d:
  if value == max_value:
    print(key)
import collections

n = int(input())
l = [input() for _ in range(n)]
c = collections.Counter(l)

ans = []
count_max = max(c.values())
for i in c.items():
    if list(i)[1] == count_max:
        ans.append(list(i)[0])

ans.sort()
for i in ans:
    print(i)
n = int(input())
c = {}
for i in range(n):
    s = input()
    if s in c:
        c[s] += 1
    else:
        c[s] = 1
max = 0
for k in c.keys():
    if c[k] > max:
        max = c[k]
hit = [k for k in c.keys() if c[k] == max]
hit.sort()
for i in range(len(hit)):
    print(hit[i])
import collections
n = int(input())
s = [input() for i in range(n)]
d = collections.Counter(s)
largest = max(d.values())
ans = []
for key in d.keys():
    if d[key] == largest:
        ans.append(key)
common_values = sorted(ans)
for val in common_values:
    print(val)
N = int(input())
cnt = {}

for _ in range(N):
    S = input()
    cnt.setdefault(S, 0)
    cnt[S] += 1

mx = max(cnt.values())
ans = sorted([v for v,c in cnt.items() if mx == c])
for v in ans:
    print(v)
N = int(input())

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

maxv = max(S.values())
ans = []
for i, j in S.items():
    if j == maxv:
        ans.append(i)

ans = sorted(ans)
for i in ans:
    print(i)
dict={}
N = int(input())
for _ in range(N):
    s = input()
    if s in dict:
        dict[s] += 1
    else:
        dict[s] = 1

max_ = max(dict.values())
A = [k for k,v in dict.items() if v == max_]
A.sort()

for a in A:
    print(a)
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)
from collections import defaultdict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
def resolve():
    N = int(input())
    from collections import defaultdict
    cnt = defaultdict(int)
    for _ in range(N):
        cnt[input()] += 1
    items = sorted(cnt.items(), key=lambda x: (-x[1], x[0]))
    max_v = items[0][1]
    for item in items:
        if max_v != item[1]:
            break
        print(item[0])

resolve()
import collections
N=int(input())
S = [input() for i in range(N)]
A=[]

P=collections.Counter(S)

y=max(P.values())
A = [k for k, v in P.items() if v == y]

A.sort()

for List in A:
    print(List)
import collections
n = int(input())
s=[input() for i in range(n)]
ans = list()

c = collections.Counter(s)

m = max(c.values())
for k,v in c.items():
    if v ==m:
        ans.append(k)
ans.sort()
print(*ans,sep="\n")
n=int(input())
lst=[input() for _ in range(n)]
#print(lst)
dict={}
for str in lst:
    if str in dict:
        dict[str]+=1
    else:
        dict[str]=1
#print(dict)
max_value=max(dict.values())
ans=[k for k,v in dict.items() if v==max_value]
ans.sort()
[print(ans[i]) for i in range(len(ans))]
from collections import Counter
N = int(input())
l = []
for i in range(N):
  l.append(input())
  
c = Counter(l).most_common()
ma = c[0][1]
ans = []
for i in c:
  if i[1] == ma:
    ans.append(i[0])
  else:
    break;
    
ans.sort()
for i in ans:
  print(i)
n = int(input())
ans = {}
for i in range(n):
	s = input()
	if(ans.get(s)):
		ans[s] +=1
	else:
		ans[s] = 1

m = max(ans.items(), key = lambda x:x[1])[1]
a = []
for t in ans.items():
	if(t[1]==m):
		a.append(t[0])

a.sort()
for t in a:
	print(t)
n=int(input())
A=[]
for i in range(n):
  A.append(input())
from collections import Counter
C=Counter(A)
qq=max(C.values())
ans=[]
for word,times in C.items():
  if times==qq:
    ans.append(word)
print(sorted(ans))
import sys
import collections
n = int(input())
li=[input() for _ in range(n)]
li.sort()
c = collections.Counter(li)
max_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
for s in max_list:
  print(s)
import collections

def main():
    n =int( input())

    cnt=dict()
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    a = [k for k, v in cnt.items() if v == max(cnt.values())]
    print("aa")
    a.sort()
    for elm in a:
        print(elm)

main()
def resolve():

    from collections import Counter

    n = int(input())

    words = [input() for i in range(n)]
    words.sort()

    word_counter = Counter(words)

    max_count = word_counter.most_common()[0][1]
    
    for c in word_counter.most_common() :
        if c[1] == max_count:
            print(c[0])

            
resolve()
from collections import Counter
n = int(input())
s = []
for _ in range(n):
    s.append(str(input()))

s_c = Counter(s).most_common()
m = s_c[0][1]

print(s_c)
print(m)
ans = []

for j in range(len(s_c)):
    if s_c[j][1] != m:
        break
    else:
        ans.append(s_c[j][0])
        
ans.sort()

for k in ans:
    print(k)
# coding: utf-8
# Your code here!

import collections

n = int(input())
c = collections.Counter([input() for i in range(n)])
m = max(c.values())
k = list(c.keys())
v = list(c.values())
for i in range(len(c)):
    if v[i] == m:
        print(k[i])
n = int(input())
s = [input() for _ in range(n)]
import collections
c = collections.Counter(s)
d = c.most_common()
e = [d[0][0]]
for i in range(len(d)-1): #nじゃない　dの長さ
   if d[0][1] == d[i+1][1]:
      e.append(d[i+1][0])       #辞書順にする
e.sort()
print(repr(e))   #print(repr(e))でもいける？
n = int(input())
a = [input() for i in range(n)]
b = list(set(a))
b.sort()

max = a.count(b[0])

for i in range(len(b)-1):
	if a.count(b[i]) < a.count(b[i+1]):
		max = a.count(b[i+1])

for j in range(len(b)):
	if a.count(b[j]) == max:
		print(b[j])
n=int(input())
a=[]
for i in range(n):
    a.append(input())
x=max(a)
c=[]
d=[]
for i in a:
    c.append(a.count(i))
for i in a:
    if a.count(i)==max(c):
        d.append(a[a.index(i)])
d=list(set(d))
for i in d:
    print(i)
from collections import Counter
 
input_line=int(input())
count=0
input_list=[]
while count < input_line:
  input_list.append(input())
  count+=1
ans_list=[]
list_set=set(input_list)
max_appeard=Counter(input_list).most_common(1)[0][1]
for item in list_set:
    appeard=Counter(input_list)[item]
    if appeard >= max_appeard:
        max_appeard=appeard
import collections
n = int(input())
s = []
for i in range(n):
  s.append(input())
s.sort()
#print(s)
c = collections.Counter(s)
#print(c.most_common())
m = c.most_common()[0][1]
l = len(c.most_common())
for i in range(l):
  if c.most_common()[i][1] == m:
    print(c.most_common()[i][0])
  else:
    break
import collections
n=int(input())
data=[""]*n
for i in range(n):
    data[i]=input()
count=collections.Counter(data)
num=max(count.values())
for v,k in count.items():
    if k==num:
        print(v)
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:
    for i in range(N):
        if counts[i] == counts[0]:
            print(values[i])
        else:
            exit()
from collections import Counter

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

lists = dics.most_common()

print(lists[0][1])
maxc = lists[0][1]

for word,cnt in lists:
	if maxc == cnt:
		print(word)
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
s.sort()
c = Counter(s)
m = c.most_common()[0][1]
for i in c.most_common():
    if i[1] == m:
        print(i[0])
n = int(input())
memo = {}
ans = []

for i in range(n):
  	a = input()
  	if a in memo:
  	    memo[a] += 1
  	    if a in ans:
  	        pass
  	    else:
  	        ans.append(a)
  	else:
  	    memo[a] = 1

max_n = 0
saigo = "a"

for i in range(len(ans)):
    if memo[ans[i]] > max_n:
        max_n = memo[ans[i]]
        saigo = ans[i]
    elif memo[ans[i]] == max_n:
        saigo += " " + ans[i]


for i in saigo.split():
    print(i)
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
ans = []
for i, j in l:
    if j == m:
        ans.append(i)
print(ans.sort())
box={}
n=int(input())
for i in range(n):
    v=input()
    if v in box:
        box[v]+=1
    else:
        box[v]=1
m=max(box.values())
f=[k for k,v in box.items() if v==m]
print('\n'.join(f))
from collections import Counter

n = int(input())

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

c = Counter(s)

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

maxc = csort[0][1]

for s,v in csort:
    if v == maxc:
        print(s)
import collections
n = int(input())
s = [input() for i in range(n)]
s.sort()
t = collections.Counter(s)
maxv = max(t.values())
for key,value in t.items():
    if value == maxv:
        print(key)
N = int(input())

S = []
for i in range(N):
  S.append([input()][0])
  
S.sort()
S_set = list(set(S))
ans = [["" for i in range(2)] for i in range(len(S_set))]
n = 0
for i in range(len(S_set)):
  count = S.count(S_set[i])
  ans[i][0] = S_set[i]
  ans[i][1] = count
  if n < count:
    n = count
    
for i in range(len(S_set)):
  if ans[i][1] == n:
    print(ans[i][0])
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
ans = []
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  ans.append(k)
  maxv = v
for a in sorted(ans, reverse=True):
  print(a)
N = int(input())
S = sorted(input() for i in range(N))

C = [0] * N

for i in range(N):
    C[i] = S.count(S[i])
    
for i in range(N):
    if C[i] == max(C) and S[i] == S[(i+1) % N]:
        print(S[i])
import collections
import itertools
N=int(input())
#P=list(map(int,input().split()))
st=[]
for i in range(N):
    s=str(input())
    st.append(s)
c = collections.Counter(st)

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

sorted(ret)
for r in ret:
    print(r)
import collections
N = int(input())
S = [input() for i in range(N)]

#重複チェック
c = collections.Counter(S)
value,count = zip(*c.most_common(len(c)))

if len(set(count)) == 1:
    s = sorted(value)
    for i in s:
        print(i)
else:
    for i in value:
        print(i)
        exit()
n = int(input())
lis = []
lis2 = {}
lis3 = []
for _ in range(n):
  lis.append(input())

for w in lis:
  if w not in lis2.keys():
    lis2[w] = 1
  else:
    lis2[w] += 1

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

for a in range(len(sort_lis2)):
  if a == 0:
    lis3.append(sort_lis2[0][0])
  else:
    if sort_lis2[0][1] == sort_lis2[a][1]:
      lis3.append(sort_lis2[a][0])

for b in lis3:
  print(b)
n = int(input())
li = []
lia = []
ans = 0
f = 1
for i in range(n):
    li.append(input())
li.sort()
for i in range(n-1):
    if li[i] == li[i+1]:
        f += 1
        if f == ans:
            lia.append(li[i+1])
        if f > ans:
            lia = []
            ans = f
            lia.append(li[i+1])
    else:
        f = 1
for i in range(len(lia)):
    print(lia[i])
n = int(input())

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

r = {}
for k, v in d.items():
  if v in r.keys():
    r[v].append(k)
  else:
    r[v] = [k]  # make list
    
t = list(r.keys())[-1]
for s in r[t]:
  print(s)
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])
import collections
a = int(input())
li1 = []

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

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])
import collections

n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)

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

counts = set(counts)
counts = list(counts)
num = counts[-1]


for i in range(num):
  print(string_list[i])
n = int(input())
s = [input() for i in range(n)]
s.sort(reverse=True)
l = set(s)
ms = len(s) - len(l)
if len(l) == 1:
    print(s[0])
    exit()
elif len(l) == n:
    s.sort()
    print("\n".join(s))
    exit()

ans = 0
ans_l = []
for i in l:
    sc = s.count(i)
    if sc > ans:
        ans_l = [i]
        ans = sc
    elif sc == ans:
        ans_l.append(i)
      
print("\n".join(ans_l))
n = int(input())
S = []
for _ in range(n):
    S.append(input())

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
    
ans = 0
for i in d:
  if ans < d[i]:
    ans = d[i]

for i in d:
  if ans == d[i]:
    print(i)
import collections

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

c=collections.Counter(l)
cc=sorted(c.most_common(max(c.values())))
for i in cc:
    print(i[0])
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()]
# S_jadge2 = [s for s in S if 1 <= len(s) <= 10]
# 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()

# if not S.islower():
#     print("error:lower")
#     sys.exit()

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

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

t = max(D)
M = D[t]
E = []
for s in D:
    if D[s] == M:
        E.append(s)

E = sorted(E)

for i in range(len(E)):
    print(E[i])
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
d = Counter(s)
a = 0
for v in d.values():
  if v>a:
    a = v
for k in d.keys():
  if d[k]==a:
    print(k)
n,*s=open(0).read().split()
t=set(sorted(s))
c=[0]*len(t)
for i,a in enumerate(t):
  c[i]=s.count(a)
m=max(c)
for i,a in zip(c,t):
  if i==m:
    print(a)
n = int(input())
dic = {}
for _ in range(n):
  s = input()
  if dic.get(s) == None:
    dic[s] = 1
  else:
    dic[s] += 1

m = max(dic.items())
l = []
for v in dic.items():
  if v[1] == m[1]:
    l.append(v[0])
sortl = sorted(l)
for i in range(len(sortl)):
  print(sortl[i])
N=int(input())
l={}

for i in range(N):
  s=input()
  if s in l:
    l[s]+=1
  else:
    l[s]=1
l=sorted(l.items(),key=lambda x: x[1],reverse=True)
ma=max(l)
ans=[]

for i in l:
  if i[1]==ma[1]:
    ans.append(i[0])

ans.sort()
  
for i in ans:
  print(i)
N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
T = {S[0]:1}
for j in range(1,N):
    if S[j] not in T:
        T[S[j]] = 1
    else:
        T[S[j]] += 1
T_sorted = sorted(T.items(),key = lambda x:-x[1])
maxT = T_sorted[0][1]
for k in range(len(T_sorted)):
    if T_sorted[k][1] != maxT:
        break
    print(T_sorted[k][0])
import collections
import numpy as np
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)]

for k,v in c.items():
    if tmp != v:
        break
    tmp = v
    l.append(k)

l = sorted(l)
for i in l:
    print(i)
# coding: utf-8
if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val]=1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    for s in values_of_max_key:
        print(s)
#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
ansallay = []
#抽出用に何回出てればansに出すかを変数に突っ込む
record = count.most_common()[0][1]
for num in range(leng-1):
    if(count.most_common()[num][1] == record):
        ansallay.append(count.most_common()[num][0])
    else:
        break
ansallay.sort()
for word in ansallay:
    print(word)
from collections import Counter

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

c = Counter(S).most_common()
a = c[0][1]
for v in c:
    if v[1] != a: break
    print(v[0])
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])
        sys.stdout.flush
from collections import Counter

n = int(input())
a = [s for s in input().split()]

c = Counter(a)
list = c.most_common()
max = list[0][1]

ans = []
for i, j in list:
    if j == max:
        ans.append(i)
    else:
        break

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

D=dict()
for i in range(N): 
    S=input()

    if S not in D:
        D[S]=1
    else:
        D[S]+=1

M=D[max(D)]
ans=[]
for s in D:
    if D[s]==M:
        ans.append(s)

ans.sort()
A=''
for s in ans:
    A+='{}\n'.format(s)

print(A)
from collections import Counter
import sys
n = int(sys.stdin.readline())
sn = sys.stdin.read().split()
c = Counter(sn)
c = sorted(c.items(), key=lambda x: (x[1], x[0]))
num = c[0][1]
for i, j in c:
  if j == num:
    print(i)
  else:
    quit()
a=int(input())
b=[input() for i in range(a)]
b.sort()
for i in range(a):
  print(b[i])
import collections

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

s.sort()
most = collections.Counter(s)

most_ans = most.most_common()
most_cnt = most_ans[0][1]
for i in most_ans:
    if most_cnt == i[1]:
        print(i[0])
n=int(input())
moto=[0]*n
for k in range(0,n):
  moto[k]=input()
syurui=list(set(moto))
kosu=[0]*len(syurui)
for k in range(0,len(syurui)):
  kosu[k]=moto.count(syurui[k])
answer=[]
for k in range(0,len(syurui)):
  if moto.count(syurui[k])==max(kosu):
    answer.append(syurui[k])
for k in range(0,len(answer)):
  print(answer[k])