peterverebics/CodeNet_Python_118 huggingface dataset:
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])

for i in range(len(s_max)):
  print(s_max[i])
N = int(input())
S = [input() for _ in range(N)]

T = list(set(S))
t = len(T)
l = [0] * t

for i in range(t):
  l[i] = S.count(T[i])
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])
import collections
N=int(input())
list1=[]
for i in range(N) :
  list1.append(input())

variety_list=dict(collections.Counter(list1).most_common())

key_list=list(variety_list.keys())
value_list=list(variety_list.values())
list2=[]


for i in range(len(value_list)) :
  if i==0 :
    list2.append(key_list[i])
  elif value_list[0]==value_list[i] :
    list2.append(key_list[i])
  else :
    break

list2.sort()
for item in list2 :
  print(item)
import collections
n = int(raw_input())
cc = collections.Counter()
m = 0
for _ in range(n):
	w=  raw_input()
	cc[w] +=1
	m = max(0,cc[w])
elems = []
for el in cc:
	if cc[el] == m:
		elems.append(el)


#elems.sort(cmp = lambda a,b: len(a)<=len(b))
elems.sort()
for el in elems:print el
N=int(input())
L=[]
M=[0]*N
for i in range(N):
  L.append(str(input()))
L.sort()
l=0
m=0
A=[]
for j in L:
  if j not in A:
    A.append(j)
    l=max(m,l)
    m=1
  else:
    m+=1
  M[A.index(j)]+=1
for k in range(N):
  if M[k]==m:
    print(A[k])
i = int(input())

dic = {}
for j in range(i):
    word = input()
    if word in dic:
        dic[word] += 1
    else:
        dic[word] = 1


dic2 = sorted(dic.items(), key=lambda x:x[1])
print(dic2)
k = len(dic2)-1
s = 0
ans = []
for p in range(len(dic2)):
    t = dic2[k][1]
    ans.append(dic2[k][0])
    k -= 1
    if t == dic2[k][1]:
        s = 1
    else:
        break
ans.sort()
for ak in ans:
    print(ak)
n=int(input())
S=[]
for i in range(n):
    S.append(input())

from collections import defaultdict
d = defaultdict(int)

for k in S:
    d[k]+=1

d=dict(d)
dmax=max(d)
ansn=d[dmax]
ans=[]
for i in d.keys():
    if d[i]==ansn:
        ans.append(i)

ans=sorted(ans)
for i in range(len(ans)):
    print(ans[i])
from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
print(res_max)
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)

ans.sort()
print(*ans, sep="\n")
n = int(input())
L = sorted(input() for _ in range(n))
s = list(set(L))
c = [0] * len(s)
for i in range(len(s)):
    c[i] = L.count(s[i])
m = max(c)
for j in range(len(c)):
    if c[j] == m:
        print(s[j])
import collections
N = int(input())
l = []
for _ in range(N):
    s = input()
    l.append(s)
c = collections.Counter(l)
i=0
j=0
while True:
    print(c.most_common()[i][0])
    if i+1<len(c.most_common()):
        if c.most_common()[i+1][1] == c.most_common()[i][1]:
            i+=1
            continue
        else:
            break
    else:
        break
import collections
N=int(input())
S=[]
for i in range(N):
  s=str(input())
  S +=[s]
T=collections.Counter(S)
answer=T.most_common()
for i in range(len(T)):
  if answer[i][1]==answer[0][1]:
    print(answer[i][0])
  else:
    break
N = int(input())
d = {}
for i in range(N):
  s = input()
  if s in d.keys():
    d[s] += 1
  else:
    d[s] = 1
l = [k for k, v in d.items() if v == max(d.values())]
#print('\n'.join(sorted(l)))
for i in l:
  print(i)
N = int(input())

S = []

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

set_S = list(set(S))
ans = []
max_cnt = 0
for i in range(len(set_S)):
  cnt = 0
  for j in range(N):
    if set_S[i] == S[j]:
      cnt += 1
  if max_cnt < cnt:
    temp = [set_S[i],cnt]
    ans.append(temp)

ans_f = []

for i in range(len(set_S)):
  if ans[i][1] == max_cnt:
    ans_f.append(ans[i][0])

ans_f.sort()

for i in range(len(ans_f)):
  print(ans_f[i])
n = int(input())
p = [str(input()) for _ in range(n)]
import collections
c = collections.Counter(p)
m = max(c.values())
ans = [key for key, value in c.items() if value == m]
for i in ans:
    print(i)
N = int(input())
A = [input() for i in range(N)]
import collections
c = collections.Counter(A)
print(c.most_common()[0][0])
#AtCoder
import collections
N = int(input())
S = []
for i in range(N):
    S.append(input())
s = sorted(S)

c = collections.Counter(s)

mx = max(c.values())

for k,v in c.items():
    if v == mx:
        print(k)
import collections

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

c = collections.Counter(s)
values,counts = zip(*c.most_common())
max_w = counts[0]
l = len(counts)

print(values[0])
i = 1
while True:
    if i < l:
        if counts[i] == max_w and i < l:
            print(values[i])
    else:
        break
    i += 1
import collections

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

count_dict = collections.Counter(data_list)

max_val = max(count_dict.values())
max_keys = [key for key in count_dict if count_dict[key] == max_val]

for i in range(len(max_keys)):
    print(max_keys[i])
import collections
N=int(input())
a=[]
for _ in range(N):
  a.append(input())
c=collections.Counter(a)
print(c.most_common(1))
N = int(input())

strs = []
dicts = {}
for i in range(N):
    s = input()
    if dicts.get(s) is not None:
        dicts[s] += 1
    else:
        dicts[s] = 1

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

i = 0
sts = []
for s in dict_sorted:
    if dicts[s[0]] >= i:
        sts.append(s[0])
    i = dicts[s[0]]

for s in sorted(sts):
    print(s)
import collections as cl
import sys
input = sys.stdin.readline

N = int(input().strip())
S_list = [input().strip() for _ in range(N)]
# print(S_list)
c = cl.Counter(S_list)
ordered = c.most_common()
max_num = max(ordered)[1]
max_list = [item[0] for item in ordered if item[1] == max_num]

print(*max_list)
from collections import *
N = int(input())
count = Counter(input().split())


m = max(count.values())


ans = [a for a,b in count.items() if b == m]
ans.sort()
for S in ans:
    print(S)
N = int(input())

S = {}

A = [""]*N
for i in range(0, N):
    A[i] = A[i] + input()

for i in range(0, N):
    if not (A[i] in S.keys()):
        S[A[i]] = 1
    else:
        S[A[i]] = S[A[i]] + 1

max = 0
for value in S.values():
    if value > max:
        max = value

S0 = {}
for key, value in S.items():
    if value == max:
        S0[key] = 0

for key in S0.keys():
    print(key)
N = int(input())
S = [input() for i in range(N)]
S_dict = {}
for i in range(N):
    if S[i] not in S_dict:
        S_dict[S[i]] = 1
    else:
        S_dict[S[i]] += 1
        
max_pol = S_dict[max(S_dict)]
ans_list = []
for key, pol in S_dict.items():
    if pol == max_pol:
        ans_list.append(key)
        
for ans in sorted(ans_list):
    print(ans)
n = int(input())
d = {}
for i in range(n):
    S = input()
    d[S] = d[S]+1 if S in d else 1
L = sorted(d.items(), key=lambda x: x[1], reverse=True)
for l in L:
    if l[1] == L[0][1]:
        print(l[0])
n = int(input())
s = []
for i in range(n):
    x = input()
    s.append(x)
s=sorted(s)
mydict = {}
for i in range(n):
    x = s[i]
    if x in mydict:
        mydict[x]+=1
    else :
        mydict[x] = 1

max_n = -1
for v in mydict.values():
    max_n = max(max_n,v)
for k in mydict:
    if mydict[k] == max_n:
        print(k)
n = int(input())
s = [input() for i in range(n)]
s.sort()

d = {}
for i in s:
    d.setdefault(i, 0)
    d[i] += 1

maxv = 0
for i in d.values():
    maxv = max(maxv,i)
for i in d.keys():
    if d[i] == maxv:
        print(i)
import collections
N = int(input())
S = [input() for _ in range(N)]

if len(S) == len(set(S)):
  print(sorted(S))
else:
  c = collections.Counter(S)
  ans = sorted([i[0] for i in c.items() if i[1] == c.most_common()[0][1]])
  [print(a) for a in ans]
n=int(input())
a = []
for i in range(n):
    a.append(input())
a_count = [a.count(i) for i in a]
print('\n'.join(set([a[i] for i in range(len(a_count)) if a_count[i] == max(a_count)])))
import collections
n = int(input())
s = list(input() for i in range(n))
s.sort()
counted = collections.Counter(s)

m = max(counted.values())
chars = [key for key, value in counted.items()
             if value == m]

for i in range(len(chars)):
    print(chars[i])
import collections

N = int(input())
S = sorted([input() for _ in range(N)])
c = collections.Counter(S)
num = c.most_common()[0][1]
for i in range(len(c)):
    if c.most_common()[i][1] == num:
        print(c.most_common()[i][0])
    else:
        break
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
S.sort()
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1

max_list = [kv for kv in input_dict.items() if kv[1] == max(input_dict.values())]
for i in range(len(max_list)):
    print(max_list[i][0])
import collections

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


print(c.most_common()[0][0])
for i in range(1, len(c)):
    if c.most_common()[i][1] == c.most_common()[i-1][1]:
        print(c.most_common()[i][0])
    else:
        break
n=int(input())
d=dict()
for _ in range(n):
    a=input()
    if a in d:
        d[a]+=1
    else:
        d[a]=1
keys = sorted([k for k,v in d.items() if v==max(d.values())])
print(keys,sep="\n")
n=int(input())
l=[]
l2=[]
for i in range(n):
    s=input()
    l.append(s)
l1=set(l)
for j in l1:
    l2.append(l.count(j))
l3=sorted(set(l2))
for k in l1:
    if l.count(k)==l3[-1]:
        print(k)
from collections import defaultdict

def solve():
    N = int(input())
    d = defaultdict(int)
    for _ in range(N):
        a = input()
        d[a] += 1

    m = 0
    for k, v in d.items():
        m = max(m, v)
    
    l = []
    for k, v in d.items():
        if m == v:
            l.append(k)
    l.sort()
    for ans in l:
        print(ans)
    
print(solve())
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

for i in range(a):
    print(str(s2[i][0]))
import collections
N = int(input())
S_list = [input() for i in range(N)]
C = collections.Counter(S_list)
L = C.most_common()
max_ = L[0][1]
for i in L:
    if i[1] == max_:
        print(i[0])
    else:
        exit()
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())

res = []
for k, v in dic.items():
  if v == max_:
    res.append(v)

res = sorted(res)
for elem in res:
  print(res)
n=int(input())
l=[]
for i in range(n):
  l.append(input())
dic=dict()
for i in range(n):
  if l[i] not in dic:
    dic[l[i]]=1
  else:
    dic[l[i]]+=1
a=max(dic)
b=dic[a]
keys = [k for k, v in dic.items() if v == b]
keys.sort()
for i in range(len(keys)):
  print(keys[i])
n = int(input())
s = [input() for i in range(n)]

vote = {}
for i in range(n):
    if s[i] in vote:
        vote[s[i]] +=1
    else:
        vote[s[i]] = 1
max_kv_list = [kv[0] for kv in vote.items() if kv[1] == max(vote.values())]
max_kv_list.sort()

print('¥n'.join(max_kv_list))
n = int(input())
input_array = []
for i in range(n):
    input_array.append(input())
counter = {}
for i in set(input_array):
    counter[i] = input_array.count(i)
max_key_list = [kv[0] for kv in counter.items() if kv[1]==max(counter.values())]
for i in max_key_list:
    print(i)
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)
for k, v in sd:
    if v != m:
        break
    print(k)
import collections

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

print_list = []
count = []
S_max = 0

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

values, counts = zip(*S_common)

#print(counts[0])

for i in range(len(values)):
	if counts[0] == counts[i]:
		print(values[i])
N = int(input())
paper = [input() for i in range(N)]

D = {}
for p in paper:
    if p not in D:
        D[p] = 1
    else:
        D[p] += 1

key = 0
max_value = 0
k = []
# 辞書の値を取り出す
for i in D:
    if D[i] > max_value:
        max_value = D[i]
        key = i
    elif D[i] == max_value:
        k.append(i)

if len(k) == 0:
    print(key)
else:
    k.append(key)
    for j in sorted(k):
        print(j)
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

print(sorted(word_ans[:ankernum]))
N = int(input())
S = []
for i in range(N):
    S.append(input())
vote = {}
for j in S:
    if j not in vote:
        vote[j] = 1
    else:
        vote[j] += 1
most = set()
highNo = 0
for k in vote:
    if vote[k] > highNo:
        most.clear()
        most.add(k)
        highNo = vote[k]
    if vote[k] == highNo:
        most.add(k)
for h in most:
    print(h)
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
m = 0
for v in c.values():
	m = max(m, v)
print(c.items())
ans = []
for k, v in c.items():
	if v == m:
		ans.append(k)
ans.sort()
print(*ans, sep="\n")
import collections
n = int(input())
s = [input() for _ in range(n)]
word = collections.Counter(s)
word = word.most_common()
word.sort()
max_num = word[0][1]
for i in range(len(word)):
    if word[i][1] == max_num:
        print(word[i][0])
from collections import Counter as cnt
n = int(input())
S = [input().replace('\n', '') for _ in range(n)]
S = sorted(S)
S = cnt(S)
m = max(S.values())
for s, i in S.items():
    if i==m: print(s)
# -*- coding: utf-8 -*-

import os
import datetime

def main():

    str_dict = {}
    val_1 = int(input())
    for i in range(val_1):
        val_x = input()

        if not val_x in str_dict:
            str_dict[val_x] = 1
        else:
            num = str_dict.get(val_x)
            str_dict[val_x] = num + 1

    for k, v in sorted(str_dict.items(), key=lambda x: -x[1]):
        print(k)




if __name__ == '__main__':
    main()
import collections
N = int(input())
List=[input() for i in range(N)]

c = collections.Counter(List)
c_sorted = sorted(c.items(), key=lambda x:x[1],reverse=True)

maxCount = c_sorted[0][1]
keys = [k for k, v in c.items() if v ==maxCount]
for s in keys:
    print(s)
n = int(input())
s = {}
for i in range(n):
    tmp = input()
    if not tmp in s.keys():
        s[tmp] = 1
    else:
        s[tmp] += 1
m = 0
l = []
for i in sorted(s.items(), key=lambda x:x[1], reverse=True):
    if m < i[1]:
        m = i[1]
        l.append(i[0])
    else:
        break

for i in sorted(l):
    print(i)
n = int(input())
s = [input() for i in range(n)]
s.sort()
l = sorted(set(s))
if len(s) == len(l):
    print("\n".join(s))
    exit()
if len(l):
    print("\n".join(s[0]))
    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))
from __future__ import print_function

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

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

ansarray = sorted(S)

P = []
count = 0
maxcount = 0
d = {}

for i in range(N-1):
    if ansarray[i+1] == ansarray[i]:
        d[ansarray[i]] = count
        count = count + 1
    if ansarray[i+1] != ansarray[i]:
        count = 0

max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]

if count == 0:
    max_k_list = ansarray
for i in range(len(max_k_list)):
    print(max_k_list[i])
import collections

n = int(input())
s = [''] * n
for i in range(n):
    print(i)
    s[i] = input()

cs = collections.Counter(s)
mcs = cs.most_common()
cnt = mcs[0][1]

fcs = [i[0] for i in cs.items() if i[1] == cnt]
ans = sorted(fcs)
for s in ans:
    print(s)
import collections

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

S = sorted(S)
C = collections.Counter(S).most_common()
M = C[0][1]

for c in C:
    if c[1] == M:
        print(c[0])
    else:
        break
from collections import defaultdict, Counter
import sys
n=int(input())
#d=defautldict(int)
l=[]
for _ in range(n):
  s=input()
  l.append(s)
c = Counter(l).most_common()
max_ = c[0][1]
for tup in c:
  p,q = tup
  if q != max_:
    sys.exit()
  else:
    print(p)
import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value in S:
        S[value] += 1
    else:
        S[value] = 1
S_sorted = sorted(S)
for ans in S_sorted:
    print(ans)
from sys import stdin
import collections

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

counted = collections.Counter(s)

m = max(counted.values())

chars = [key for key, value in counted.items()
             if value == m]
moji = '\n'.join(chars)

print(moji)
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()

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())
N = int(input())
S = []
for i in range(N):
    S.append(str(input()))
dict_uni = {x:S.count(x) for x in set(S) if S.count(x)>=1}
dict_sorted = sorted(dict_uni.items(), key=lambda x:x[1], reverse=False)
for i in dict_sorted:
    print(i[0])
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)
n=int(input())
string_list=[input() for i in range(n)]
import collections
import numpy as np
c = collections.Counter(string_list)
d=c.most_common()
x=int(d[0][1])
z=[]
for i in range(len(d)):
  y=int(d[i][1])
  if x==y:
    z.append(str(d[i][0]))
    
z.sort(reverse=True)
for i in range(len(z)):
  print(z[i])
N = int(input())
S = input().split()
S_set = set(S)
maxnum = 0
for i in S_set:
    if S.count(i)>maxnum:
        maxnum = S.count(i)

for i in S_set:
    if S.count(i) == maxnum:
        print(i)
N = int(input())
dic = {}
for i in range(1,N+1):
    key = input()
    if key not in dic:
        dic[key] = 1
    else:
        dic[key] += 1
lis = []
for key,val in dic.items():
    lis.append([val,key])
lis.sort(reverse = True)

lis2 = []
fnum = lis[0][0]
j = 0
for x in range(0,len(lis)): 
    if lis[j][0] == fnum:
        lis2.append(lis[j][1])
    else:
        break
lis2.sort()
for k in lis2:
    print(k)
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]
for val in mc:
    if max == val[1]: print(val[0])
    else: break
n = int(input())
l = []
for _ in range(n):
    ll = input()
    l.append(ll)
    
ss = set(l)
s = list(ss)

ans = []
for i in range(len(s)):
    cnt = l.count(s[i])
    ans.append(cnt)
    
m = max(ans)
res = []
for j in range(len(ans)):
    if ans[j] == m:
        res.append(l[j])
        
res.sort()
for k in range(len(res)):
    print(res[k])
n = int(input())
s = []
for i in range(n):
    s.append(input())


numbers = dict()
for val in s:
    if val in numbers:
        numbers[val] += 1
    else:
        numbers[val] = 1

[print(kv[0]) for kv in numbers.items() if kv[1] == max(numbers.values())]
N= int(input())
S = [""] * (N)
C = [0] * (N)

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

D=list(set(S))

for i in range(len(D)):
	C[i] = S.count(D[i])

MAX=max(C)
for i in range(len(C)):
	if C[i]==MAX:
		print(D[i])
import collections

N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
a = [c.most_common()[0][0]]
i = 0
if len(c) != 1:
    while c.most_common()[i][1] == c.most_common()[i + 1][1]:
        a.append(c.most_common()[i + 1][0])
        i += 1
        if i == len(c) -1:
            break
for p in a:
    print(p)
n = int(input())
a = [input() for hoge in range(n)]
b = sorted(a)
c = set(a)
d = 0
ans = []
for poge in c:
  if d < b.count(poge):
    d = b.count(poge)
for raw in b:
  if d == b.count(raw):
    ans.append(raw)
answer = set(ans)
for q in answer:
  print(q)
N = int(input())
d = {}
for _ in range(N):
  s = input()
  if not s in d:
    d[s] = 1
  else:
    d[s] += 1
x = sorted(list(d.items()), key=lambda x:x[1], reverse=True)
n = 0
for k, v in x:
  if v >= n:
    n = v
    print(k)
n=int(input())
list_s=[]
for i in range(n):
  s=input()
  list_s.append(s)
list_cnt=[]  
list_t=list(set(sorted(list_s)))  
for i in list_t:
  cnt=list_s.count(i)
  list_cnt.append(cnt)
  
for i in range(len(list_cnt)):
  if list_cnt[i]==max(list_cnt):
    print(list_t[i])
N = int(input())
l = []

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

import collections
c = collections.Counter(l)
c = c.most_common()

most_count = c[0][1]
for i in range(len(c)):
    if c[i][1] == most_count:
        print(c[i][0])
from collections import Counter
N=int(input())
S=[input() for i in range(N)]
s=Counter(S)
m=max(s.values())
s=sorted(s.items() ,key=lambda s:s[0])

print(s)
from collections import Counter

N = int(input())
L = [input() for _ in range(N)]
import collections
strlist = []
N = int(input())
for i in range(N):
    strlist.append(str(input()))
    
c = collections.Counter(sorted(strlist))
p = max(c.values())
for i in c.most_common():
    if i[1] == p:
        print(i[0])
import collections

N = int(input())
list_1 = [input() for i in range(N)]
list_2 = collections.Counter(list_1)

for i in list_2:
    print(i)

m = max(list_2.values())

ans = [k for k in list_2 if list_2[k] == m]

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

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

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

S = sorted(S)
# 配列カウントして入れてくれる
cnt = collections.Counter()
# カウンターして連想配列
for i in range(N):
    cnt[S[i]] += 1

max_k_list = [kv[0] for kv in cnt.items() if kv[1] == max(cnt.values())]

for i in range(len(max_k_list)):
    print(max_k_list[i])
n = input()
a = input().split(" ")
b = set([x for x in a if a.count(x) > 1])

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

from collections import Counter
ls = Counter(S).most_common()
MAX = ls[0][1]

for s,length in ls:
    if MAX == length:
        print(s)
    else:
        exit()
n = int(input())
x = [input() for i in range(n)]
i = 0
count, yo = [], []

while not(x == []):
  a = x.count(x[i])
  count.append(a)
  yo.append(x[i])
  x.remove(x[i])
  
for k, c in enumerate(count):
  if c == max(count):
    print(yo[k])
import collections
N = int(input())
S = [input() for n in range(N)]

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

for k, v in dict(sorted(cnt.items())).items():
    if v == m:
        print(k)
import sys
n = int(sys.stdin.readline())
li = []
for _ in range(n):
  li.append(sys.stdin.readline().strip())
max = 0
li2 = list(set(li))
li3 = []
for i in li2:
  if li.count(i) > max:
    li3 = [i]
  elif li.count(i) == max:
    li3.append(i)
li3.sort()
print('\n'.join(li3))
from collections import defaultdict

N = int(input())
d = defaultdict(int)

for _ in range(N):
    d[input()] += 1

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

M = d[0][1]

for k, v in d:
    if v == M:
        print(k)
    else:
        break
n = int(input())
dic = {}
b = []
for i in range(n):
    a = input()
    b.append(a)
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
M = max(dic.values())
for j,k in sorted(dic.items()):
    if k == M:
        print(j)