peterverebics/CodeNet_Python_118 huggingface dataset:
from collections import Counter
def main():
    N = int(input())
    d = Counter()
    l = 0
    for _ in range(N):
        s = input()
        if s not in d:
            d[s] = 1
        else:
            d[s] += 1
        l = max(d[s], l)
    d2 = []
    for i in d:
        if d[i] == l:
            d2.append(i)
    d2.sort()
    for j in d2:
        print(j)
main()
import collections
N=int(input())
S = [str(input()) for _ in range(N)]
c = collections.Counter(S)
most = []
most_num=c.most_common()[0][1]
for i in c.most_common():
    if i[1]==most_num:
        most.append(i[0])
most.sort()
for i in most:
    print(i)
N = int(input())
words = {}
ans = []
for i in range(N):
  w = input()
  words.setdefault(w, 0)
  words[w] += 1
m = max(list(words.values()))
for k, v in words.items():
  if v == m:
    ans.append(k)
ans.sort()
for w in ans:
  print(w)
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
max = max(c.values())
 
max_k_list = [kv[0] for kv in c.items() if kv[1] == max]
max_k_list.sort()
for l in max_k_list:
    print(l)
n = int(input())
s_li = [input() for x in range(n)]
from collections import Counter
c = Counter(s_li)
c = c.most_common()
tmp = c[0][1]
res = []
for x in c:
    if tmp > x[1]:
        break
    res.append(x[0])
res.sort()
for x in res:
    print(x)
from collections import Counter

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

c = Counter(S)
m = max(c.values())

res = []
for i in c:
    if c[i] == m:
        res.append(i)

for i in sorted(res):
    print(i)
from collections import *
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    c = Counter()
    m = 0
    S = [input() for i in range(N)]
    for s in S:
        c[s] += 1
        m = max(m, c[s])

    ans = sorted([k for k, v in c.items() if v == m])
    print('\n'.join(ans))
if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
import collections

N = int(input())

all_str = []
for i in range(N):
    str_temp = input()
    all_str.append(str_temp)
all_str.sort()
coll_str = (collections.Counter(all_str))
count_max = 0
j = 0
max_str = coll_str.most_common()
for i in max_str:
    
    num_of_str =  i[1]
    if num_of_str == count_max or j == 0:
        print(i[0])
        j = 1
        count_max = num_of_str
        
    if num_of_str < count_max:
        break
N = int(input())

ans = {}
M = 1
for _ in range(N):
    word = input()
    tmp = ans.get(word)
    if tmp == None:
        ans[word] = 1
    else:
        ans[word] = tmp + 1
        if tmp + 1 > M:
            M = tmp + 1

tmp = sorted(list(ans.keys()))
for t in tmp:
    if M == ans.get(t):
        print(t)
import collections

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

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

c = collections.Counter(s)

for i in c.items():
    if i[1] > max:
        max = i[1]

s2 = [i[0] for i in c.items() if i[1] == max]

s2.sort()

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

S.sort()

maxint = 1

sdic = {}

for s in S:
    if s in sdic:
        sdic[s] += 1
        if sdic[s] > maxint:
            maxint = sdic[s]

    else:
        sdic[s] = 1

for s in sdic:
    if sdic[s] == maxint:
        print(s)
import collections as co
n = int(input())
s = []
for i in range(n):
    s.append(input())
SS = co.Counter(s)
ma = max(SS.values())

ans = []
for i in SS.keys():
    if SS[i] == ma:
        ans.append(i)

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

S = [input() for i in range(N)]
table = collections.defaultdict(int)
for x in S:
    table[x] += 1

table = list(table.items())
table.sort(key=lambda x: x[1], reverse=True)
ans = []
k = table[0][1]
for x, i in table:
    if i == k:
        ans.append(x)
ans.sort()
for x in ans:
    print(x)
from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
S = S.most_common()
most_count = S[0][1]
S.sort()
for i in range(len(S)):
    if S[i][1] == most_count:
        print(S[i][0])
from collections import Counter

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

s = s.most_common()

k = s[0][1]
lst = []
for i in range(len(s)):
    if k == s[i][1]:
        lst.append(s[i][0])
    else:
        break

lst = sorted(lst)
for i in lst:
    print(i)
import collections

n = int(input())

s=[]
for i in range(n):
    s.append(input())
    
c = collections.Counter(s)
c = sorted(c.items())
c_sorted = sorted(c, key=lambda x:x[1],reverse=True)

num=c_sorted[0][1]
for i in c_sorted:
    if num==i[1]:
        print(i[0])
    else:
        break
N = int(input())
S = []
for i in range(N):
    S.append(input())
T = {}
for i in range(N):
  if S[i] in T:
    T[S[i]] += 1
  else:
    T.setdefault(S[i],1)
A = max(T.values())

keys = [k for k, v in T.items() if v == A]
U =sorted(keys)

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

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

c = Counter(S).most_common()
m = c[0][1]
print("\n".join(sorted(s[0] for s in c if s[1] == m)))
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
s=s2(n)

from collections import Counter
c=Counter(s)
d=dict(c.most_common())
m=max(d.values())
a=[x for x,y in d.items() if y==m]
[print(x) for x in sorted(a)]
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

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


for i in sorted(ans):
    print(i)
n = int(input())
ss = []

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

d = {}
m = 0

for s in ss:
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
    m = max(d[s], m)

ans = sorted([k for k, v in d.items() if v == m])

print('\n'.join(ans))
N = int(input())
S = dict()
for i in range(N):
    s = input()
    if s not in S:
        S[s] = 1
    else:
        S[s] += 1
S = sorted(S.items(), key=lambda x:(x[1],x[0]))
m = S[-1][1]
for i in range(len(S)):
    s = S[i][0]
    if S[i][1] == m:
        print(s)
N = int(input())
dic = {}
for i in range(N):
    s = str(input())
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1

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

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

for i in range(len(X)):
    print(x[i])
n = int(input())
d = {}
max_ = 1
for i in range(n):
    s = input()
    if d.get(s) is None:
        d[s] = 1
    else:
        d[s] += 1
        if max_ < d[s]:
            max_ = d[s]
ans = sorted(d.items())
for k, v in ans:
    if v == max_:
        print(k)
n=int(input())
d={}
for _ in range(n):
  s=input()
  if s in d:
    d[s]+=1
  else:
    d[s]=1
m=max(d.values())
ans=[]
for i,k in d.items():
  if m==k:
    ans.append(i)
for i in sorted(ans):
  print(i)
N = int(input())
list_S = [input() for i in range(N)]

from collections import Counter
dict_C = Counter(list_S)
max = max(dict_C.values())

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

for ans in keys :
    print(ans)
n = int(input())
dic = {}

max = 0
for i in range(n):
    string = input()
    dic.setdefault(string, 0)
    dic[string] = dic[string] + 1
    if(dic[string] > max):
        max = dic[string]

dic2 = sorted(dic.items())
for s ,val in dic2:
    if(val == max):
        print(s)
N = int(input())
*S, = [input() for _ in [0]*N]

cnt = {}
for s in S:
    cnt[s] = cnt.get(s,0) + 1

M = max(cnt.values())
ans = []
for k,v in cnt.items():
    if v==M:
        ans.append(k)
ans.sort()
for out in ans:
    print(out)
N = int(input())
d = {}
for i in range(N):
  s = input()
  if s not in d.keys():
    d[s] = 1
  else:
    d[s] += 1
a = max(d.values())
d = sorted(d.items(), key=lambda x: x[1])
l = []
for i, j in d:
  if j == a:
    l.append(i)
l = sorted(l)
for i in range(len(l)):
  print(l[i])
import collections
N = int(input())
l = [input() for i in range(N)]
L = collections.Counter(l)
a = L.most_common()
M = a[0][1]
A = [j[0] for j in a if j[1] == M]
[print(k) for k in sorted(A)]
N = int(input())
words = {}
max_count = 1
for i in range(N):
    new = input()
    if new in words:
        words[new] += 1
        if words[new] > max_count:
            max_count = words[new]
    else:
        words[new] = 1
ans = []
for word in words:
    if words[word] == max_count:
        ans.append(word)
        
ans.sort()

for elem in ans:
    print(elem)
from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    s_c_max = s_c.most_common()[0][1]
    keys =[k for k, v in s_c.items() if v == s_c_max]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()
import collections
n=int(input())
s=list(input() for _ in range(n))

s1=collections.Counter(s)
s2=max(s1.values()) 
count=list(s1.values()).count(s2)
values, counts = zip(*s1.most_common(count))
ans=list(values)
ans.sort()
print('\n'.join(ans))
dic = {}
for i in range(int(input())):
    s = input()
    if s in dic:
        dic[s] = dic[s] + 1
    else:
        dic[s] = 1
max_v = max(dic.values())
ret = [k for k, v in dic.items() if v == max_v]

ret.sort()
print('\n'.join(ret))
import collections
n = int(input())
s = [str(input()) for _ in range(n)]
s = collections.Counter(s)
s = s.most_common()
c = s[0][1]
ans = []
for i in range(len(s)):
    if s[i][1] == c:
        ans.append(s[i][0])
ans.sort()
for i in ans:
    print(i)
n = int(input())

s_dic = {}

for i in range(n):
    tmp = str(input())
    if tmp not in s_dic:
        s_dic[tmp] = 1
    else:
        s_dic[tmp] += 1

tmp = max(s_dic.values())
max_s_key = [s_value[0] for s_value in s_dic.items() if s_value[1] == tmp]

max_s_key = sorted(max_s_key)

for i in max_s_key:
    print(i)
# coding: utf-8
N = int(input())
d = {}
for i in range(N):
    s = input()
    if s not in d.keys():
        d[s] = 1
    else:
        d[s] += 1
ans = []
v = max(d.values())
for k in d.keys():
    if d[k] == v:
        ans.append(k)
ans.sort()
for i in range(len(ans)):
    print(ans[i])
n = int(input())
dic = {}
for i in range(n):
    s = input()
    try:
        dic[s] += 1
    except:
        dic[s] = 1
high=max(dic.values())
val= sorted(dic.items())
for i in val:
    if(i[1]==high):
        print(i[0])
from collections import Counter
 
N = int(input())
S = list(input() for i in range(N))
 
d = Counter(S)

num = max(d.values())
max_k_list = [i for i,j in d.items() if j == num]

ans = '\n'.join(sorted(max_k_list))
print(ans)
n = int(input())
s = []
for _ in range(n):
    s.append(input())
s = sorted(s)
s.append('')
tmp_max = []
tmp = ''
cnt_max = 0
cnt = 0
for ss in s:
    if tmp == ss:
        cnt += 1
    else:
        if cnt > cnt_max:
            cnt_max = cnt
            tmp_max = []
        if cnt == cnt_max:
            tmp_max.append(tmp)
        tmp = ss
        cnt = 1
tmp_max = sorted(tmp_max)
for t in tmp_max:
    print(t)
N = int(input())
S =  {}
count_max = 0
for i in range(0, N):
  si = input()
  if si in S:
    S[si] = S[si] + 1
  else:
    S[si] = 1
  if S[si] > count_max:
    count_max = S[si]

arr = []
for k in S:
  if S[k] == count_max:
    arr.append(k)
    
arr.sort()
print(*arr, sep='\n')
N=int(input())
d=dict()
for i in range(N):
    s=input()
    if s in d:
        d[s]+=1
    else:
        d[s]=1
max_value=max(d.values())
list_dic=[]
for key,value in d.items():
    if value==max_value:
        list_dic.append(key)
list_dic.sort()
for i in list_dic:
    print(i)
import collections as cl
n=int(input())
s=[input() for _ in range(n)]

dic=cl.Counter(s)
m=max(dic.values())

ret=[k for k,v in dic.items() if v==m]

print('\n'.join(sorted(ret)))
n = int(input())

dict = {}
max_count = 0
for i in range(n):
  input_line = input()
  if input_line in dict:
    dict[input_line] += 1
  else:
    dict[input_line] = 1
  if max_count < dict[input_line]:
    max_count = dict[input_line]

keys = [k for k, v in dict.items() if v == max_count]
keys.sort()
print("\n".join(keys))
from collections import Counter


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

d = Counter(S)
M = max(d.values())

outs = [k for k, v in d.items() if v == M]
outs.sort()

for word in outs:
    print(word)
# -*- coding: utf-8 -*-


def main():
    from collections import Counter

    n = int(input())
    s = [input() for _ in range(n)]
    c = sorted(Counter(s).items(), key=lambda x: x[1], reverse=True)
    max_value = c[0][1]
    ans = list()

    for key, value in c:
        if value == max_value:
            ans.append(key)

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


if __name__ == '__main__':
    main()
import collections
from sys import stdin


def get_result(data):
    N, S = data[0], data[1:]
    c = collections.Counter(S)
    max_count = max(c.values())
    output_s = [key for key, val in c.items() if val == max_count]
    output_s = sorted(output_s)
    return '\n'.join(output_s)

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [val for val in raw_data]
    result = get_result(data)
    print(result)
def main():
    n = int(input())
    s = [input() for i in range(n)]
    res = {}
    for i in s:
        if i not in res:
            res[i] = 1
        res[i] += 1
    keys = max(res.values())
    max_keys = sorted([key for key in res if res[key] == keys])
    for k in max_keys:
        print(k)

if __name__ == "__main__":
    main()
from collections import Counter
a=int(input())

l=[]
x = [input() for _ in range(a)]
count=Counter(x)
x=count.most_common()
x.sort()
y=x.copy()
y.sort(key=lambda x:x[1],reverse=True)
tmp=y[0][1]
for i in x:
    if tmp <= i[1]:
        l.append(i[0])
        tmp=i[1]

print('\n'.join(l))
n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1

m = max(d.values())
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)
N = int(input())
M = { }
for i in range(N):
  S = input()
  if S not in M:
    M[S] = 0
  M[S] += 1
#print(M)
n = max(M.values())
l = []
for S in M.keys():
  if M[S] == n:
    l.append(S)
l.sort()
for S in l:
  print(S)
N = int(input())
S = list(input() for _ in range(N))

S_set= sorted(list(set(S)))

dic = dict(zip(S_set, [0 for _ in range(len(S_set))]))

for s in S: dic[s] += 1

K_max = max(list(dic.values()))
        
for (i,s) in enumerate(sorted(S_set)): 
    if dic[s] == K_max: 
        print(s)
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]
    ans = []
    for s in c.most_common():
        # print(s)
        if s[1] == cnt:
            ans.append(s[0])
    ans.sort()
    for a in ans:
        print(a)


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

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

str = collections.Counter(s)
cntmax = str.most_common()[0][1]

slist = list(str.items())

ans = []
for i in range(len(set(s))):
    if slist[i][1] == cntmax:
       ans.append(slist[i][0])
ans.sort()

for i in range(len(ans)):
    print(ans[i])
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
mc = Counter(s).most_common()
ans = [i[0] for i in mc if i[1] == mc[0][1]]
ans.sort()
for i in ans:
    print(i)
from collections import Counter
n = int(input())
S = []
for i in range(n):
  S.append(input())
S = sorted(S)
c = Counter(S)
X = c.most_common()
A = []
for i in range(len(X)):
  if X[0][1] == X[i][1]:
    A.append(X[i][0])
  else:
    break
A = sorted(A)
for i in range(len(A)):
  print(A[i])
from collections import Counter
n = int(input())

l = [input() for i in range(n)]
l.sort()
c = Counter(l)

max = c.most_common()[0][1]
outs = []
for k, v in c.most_common():
    if v == max:
        outs.append(k)

outs.sort()
for out in outs:
    print(out)
from collections import Counter

n = int(input())

kw = Counter()
for i in range(n):
    s = input()
    kw[s] += 1

v = max(kw.values())
ans = []

for key, value in kw.most_common():
    if value == v:
        ans.append(key)

for s in sorted(ans):
    print(s)
dic = {}
l = []
n = int(input())
for i in range(n):
    s = input()

#sが新規キーか否かで操作を変える
    if s in dic:
        dic[s] += 1
#新規ではないならvalueを1増やす
    else:
        dic[s] = 1
          
m = max(dic.values())

for i in dic:
    if dic[i] == m:
        l += [i]

print(*sorted(l))
import sys
from collections import Counter

input = sys.stdin.readline


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

    c = Counter(S)
    ans = []
    prev_v = 0
    for k, v in c.most_common():
        if prev_v == 0:
            prev_v = v
        else:
            if prev_v != v:
                break
        ans.append(k)

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


if __name__ == "__main__":
    main()
def resolve():
    n = int(input())
    d = {}
    for _ in range(n):
        s = input()
        if s not in d:
            d[s] = 1
        else:
            d[s] += 1
    d = sorted(d.items(), key=lambda x:x[1], reverse=True)
    ans = []
    before = d[0][1]
    for t in d:
        if t[1] != before:
            break
        else:
            ans.append(t[0])
    ans = list(sorted(ans))
    print(*ans, sep="\n")
resolve()
from collections import Counter


def main():
    n = int(input())
    S = [input() for _ in range(n)]
    S_c = Counter(S)
    num = list(S_c.values()).count(max(list(S_c.values())))
    anss = S_c.most_common()[:num]
    for ans in sorted(anss):
        print(ans[0])


if __name__ == '__main__':
    main()
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N = int(input())
s = [0]*N
for i in range(N):
    s[i] = input()
from collections import Counter
c = Counter(s)
li = []
m = max(list(c.values()))
for i in list(c.keys()):
    if c[i] == m:
        li.append(i)
li.sort()
for i in range(len(li)):
    print(li[i])
import collections

N = int(input())
L = [input() for _ in range(N)]
result = []
c = collections.Counter(L)
mostC =  c.most_common()[0][1]

for k,v in c.items():
    if v == mostC:
        result.append(k)

result.sort()

for name in result:
    print(name)
n = int(input())
s = [ input() for _ in range(n) ]

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

maxi = max(d.values())
t = list(set([ ss for ss in s if d[ss] == maxi]))
t.sort()
print("\n".join(t))
import sys
import math
import itertools
import numpy
import collections

rl = sys.stdin.readline

n = int(rl())

li = []
for _ in range(n):
    li.append(rl().rstrip())
c = collections.Counter(li)
max_cnt = 0
li = []
for k, v in c.items():
    if v < max_cnt:
        continue
    elif v == max_cnt:
        li.append(k)
    else:
        max_cnt = v
        li = [k]
li.sort()
print('\n'.join(li))
n = int(input())
d = {}
for i in range(n):
    s = input()
    if not s in d:
        d[s] = 1
    else:
        d[s] += 1
largest = max(d.values())
common_values = []
for key in d.keys():
    if d[key] == largest:
        common_values.append(key)
common_values = sorted(common_values)
for val in common_values:
    print(val)
n=int(input())
dic={}
cnt=1
s=[input() for i in range(n)]
for i in s:
    if i in dic:
        dic[i]+=1
        cnt=max(cnt,dic[i])
    else:
        dic[i]=1
ans=[]
for i in s:
    if dic[i]==cnt:
        ans.append(i)
ans=list(set(ans))
ans.sort()
for i in ans:
    print(i)
n = int(input())
dic = {}
for i in range(n):
    s = input()
    if s in dic.keys():
        dic[s] += 1
    else:
        dic[s] = 1

max_val = max(dic.values()) 

for w in sorted(dict(filter(lambda x: x[1] == max_val, list(dic.items()))).keys()):
    print(w)
from collections import Counter

N, *S = open(0).read().split()

C = Counter(S).most_common()

ma = C[0][1]
ans = sorted(k for k, v in C if v == ma)

for a in ans:
    print(a)
n = int(input())
dic = {}

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

dic = sorted(dic.items())
dic = sorted(dic, key=lambda x: -x[1])
dic.append(('_', 0))
for i in range(n):
    if dic[i][1] == dic[i + 1][1]:
        print(dic[i][0])
    else:
        print(dic[i][0])
        break
import collections

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

for i in range(N):
  SSS.append(input())
#print(N, SSS)

#print(collections.Counter(SSS).most_common())
hindo_ck = collections.Counter(SSS).most_common()

i = 1
hindo_max = list(hindo_ck[0])

if len(hindo_ck) > 1:
  del hindo_max[-1]
  while i < N and hindo_ck[i-1][1] == hindo_ck[i][1]:
    hindo_max.append(hindo_ck[i][0])
    i += 1
  hindo_max.sort()
  
  for h in hindo_max:
    print(h)
  
else:
  hindo_max = hindo_ck[0][0]
  print(hindo_max)
#print(result)
n = int(input())
dict={}
while n > 0:
    s = input()
    if s in dict.keys():
        dict[s] = dict[s] + 1
    else:
        dict[s]=1
    n = n - 1
maxnum = 0
for v in dict.values():
    if v > maxnum:
        maxnum = v
a=[]
for k,v in dict.items():
    if v == maxnum:
        a.append(k)
a.sort()
for s in a:
    print(s)
import collections
n = int(input())
s = [input() for i in range(n)]
s = collections.Counter(s)
m = 0
ans = []

for i in s.values():
  m = max(m,i)

for k, j in s.items():
  if j == m:
    ans.append(k)
ans.sort()

for i in range(len(ans)):
  print(ans[i])
#print(*ans, sep = "\n")
def poll(arr):
    ans_h = {}
    for ele in arr:
        if ele in ans_h.keys():
            ans_h[ele] += 1
        else:
            ans_h[ele] = 0
    max_v = max(ans_h.values())
    mkv = [kv for kv in ans_h.items() if kv[1] == max_v]
    for ele in sorted(mkv):
        print(ele[0])

if __name__ == "__main__":
    n = int(input())
    arr = [input() for _ in range(0, n)]
    poll(arr)
N = int(input())
dic, rst = {}, []
for i in range(N):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
max_val = max(dic.values())
rst = [ key for key, val in dic.items() if val == max_val ]
[ print(i) for i in sorted(rst) ]
import collections

n = int(input())
s = [''] * n
for i in range(n):
    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 = [str(input()) for i in range(N)]
new_S = collections.Counter(S)
M = max(new_S.values())
X = []
for K,V in new_S.items():
  if V == M:
    X.append(K)
X.sort()
for x in X:
  print(x)
from collections import Counter

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

counter = Counter(S)
m = max(counter.values())

for name in counter.keys():
    if m==counter[name]:
        result.append(name)

result_sort=sorted(result)

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

N = int(input())

data = []
val = [0]*N

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

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

mostc = c.most_common()
mostv = mostc[0][1]

ans = []
for x in mostc:
    if x[1] == mostv:
        ans.append(x[0])

ans.sort()

for y in ans:
    print(y)
n = int(input())
s = []
for i in range(n):
  s.append(input())
s.sort()
k = 0
f = s
mk = 0
for i in range(n-1):
  if s[i] == s[i+1]:
    k = k+1
    if k == mk :
      mk = k
      f.append(s[i])
    elif k > mk :
      mk = k
      f = [s[i]]
  else:
    k = 0
for i in range(len(f)):
  print(f[i])
n=int(input())

dictA={}

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

maxnum=0
candlist=list(dictA.keys())
candlist.sort()
maxlist=[]

for i in candlist:
	if dictA[i]>maxnum:
		maxlist.clear()
		maxlist=[i]
		maxnum=dictA[i]
	elif dictA[i] == maxnum:
		maxlist.append(i)



for i in maxlist:
	print(i)
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
C = Counter(s)
L = C.most_common()
x = 0
ans = []
for i, l in enumerate(L):
    if i == 0:
        x = l[1]
        ans.append(l[0])
    elif x == l[1]:
        ans.append(l[0])
    else:
        break
ans.sort()
for a in ans:
    print(a)