peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

from collections import defaultdict

n = ni()
ss = nsn(n)

d = defaultdict(int)
for i in range(n):
    d[ss[i]] += 1

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

ans.sort()
for i in ans:
    print(i)
from collections import Counter

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

c = Counter(ss)

max_count = max(c.values())

out_k = []
for k, v in c.items():
  if v == max_count:
    out_k.append(k)
out_k.sort()
for k in out_k:
  print(k)
def main():
    N = int(input())
    str_dict = dict()
    for n in range(N):
        s = input()
        if s in str_dict:
            str_dict[s] += 1
        else:
            str_dict[s] = 1
    max_s = max(str_dict.values())
    result_list = list()
    for a, b in str_dict.items():
        if b == max_s:
            result_list.append(a)
    result_list.sort()
    for r in result_list:
        print(r)


if __name__ == '__main__':
    main()
n = int(input())
dic = {}
for i in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse=True)
ans = []
s = []
for k, v in dic_sorted:
    s.append(v)
pre = s[0]
for k, v in dic_sorted:
    if v == pre:
        ans.append(k)
    else:
        break
ans.sort()
for i in ans:
    print(i)
n = int(input())
max_num = 0
s_dic = {}
for i in range(n):
    input_line = input()
    if input_line in s_dic:
        s_dic[input_line] = s_dic[input_line] + 1
    else:
        s_dic[input_line] = 1
    if s_dic[input_line] > max_num:
        max_num = s_dic[input_line]

anser_list = []
for key,value in s_dic.items():
    if value == max_num:
        anser_list.append(key)

anser_list.sort()
for key in anser_list:
    print(key)
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 = sorted(max_name)

for n in max_name:
    print(n)
num = int(input())

put = []
stor = {}
i=0
while i<num :
    name = input()
    if name in stor.keys():
        stor[name] += 1
    else:
        stor[name] = 1
    i += 1

stor=sorted(stor.items(), key=lambda item:item[1], reverse=True)

m = stor[0][1]

for i in range(0,len(stor)):
    if stor[i][1]==m:
        put.append(stor[i][0])
    else:
        break
put.sort()

for i in put:
    print(i)
from collections import defaultdict
d = defaultdict(int)
N = int(input())
MAX = 0
max_keys = []
for i in range(N):
    k = input()
    d[k] += 1
    if d[k] == MAX:
        max_keys.append(k)
    elif d[k] > MAX:
        MAX = d[k]
        max_keys = [k]

for i in sorted(max_keys):
    print(i)
# for i in sorted([i for i, v in d.items() if v == max(d.values())]):
#     print(i)
N = int(input())
dc={}
for i in range(N):
  s=input()
  if s in dc:
    dc[s]+=1
  else:
    dc[s]=1
m=max(dc.values())
w = [kv[0] for kv in dc.items() if kv[1] == m]
w.sort()
for p in w:
  print(p)
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
from fractions  import gcd

#input=sys.stdin.readline
n=int(input())
dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
m=max(dic.values())
dic=sorted(dic.items(),key=lambda x: x[0])
for i in range(len(dic)):
    if dic[i][1]==m:
        print(dic[i][0])
import collections

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

setted_S = set(S)
counted_S = collections.Counter(S)
sorted_S = sorted(counted_S.items(), key=lambda x: x[1], reverse=True)

ans_ls = []
for s in sorted_S:
    a = sorted_S[0][1]
    if s[1] == a:
        ans_ls.append(s[0])
    else:
        break

ans_ls.sort()

for i in ans_ls:
    print(i)
import collections

N = int(input())
area = []
for i in range(N):
    area.append(input())
c = collections.Counter(area)
max_val = max(c.values())
keys_of_max_val = [key for key in c if c[key] == max_val]
keys_of_max_val.sort()
for i in keys_of_max_val:
    print(i)
import sys
from collections import defaultdict

N = int(sys.stdin.readline().rstrip())

d = defaultdict(int)

for _ in range(N):
    s = sys.stdin.readline().rstrip()
    d[s] += 1

# print(d)
d2 = sorted([(v, k) for k, v in d.items()])
m = max(d2)[0]  # v の回数で max を拾う
# print(m)
for v, k in d2:
    if v == m:
        print(k)
n = int(input())
s = []
for _ in range(n):
    s.append(input())
set_s = set(s)
dict_s = {}
for si in set_s:
    dict_s[si] = 0
for si in s:
    dict_s[si] += 1
sorted_ds = sorted(dict_s.items(), key=lambda x: x[1], reverse=True)
f = True
for str_, c in sorted_ds:
    if f:
        list_ = [str_]
        p = c
        f = False
    else:
        if c == p:
            list_.append(str_)
list_ = sorted(list_)
for si in list_:
    print(si)
N = int(input())

S = {}

for i in range(N):
    s = input()
    S[s] = S.get(s, 0) + 1

SS = sorted(S.items(), key=lambda t: t[1], reverse=True)

t = []
max_v = 0
for k, v in SS:
    if v < max_v:
        break

    t.append(k)
    max_v = v 

print("\n".join(sorted(t)))
import sys
input = sys.stdin.readline
from collections import defaultdict
N, = map(int, input().split())
d = defaultdict(int)
for _ in range(N):
    s = input().strip()
    d[s] += 1
mx = 0
for k in d:
    mx = max(d[k], mx)
rs = set()
for k in d:
    if d[k] == mx:
        rs.add(k)
rs = list(rs)
rs.sort()
for r in rs:
    print(r)
n = int(input())

s = {}

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

sorted_s = sorted(s.items(), key=lambda x:x[1], reverse=True)
max_v = sorted_s[0][1]
ans = []
for i in range(len(sorted_s)):
    if max_v == sorted_s[i][1]:
        ans.append(sorted_s[i][0])
    else:
        break
ans.sort()
for a in ans:
    print(a)
from collections import Counter


def solve(string):
    n, *s = string.split()
    c = Counter(s)
    _, v = c.most_common(1)[0]
    l = sorted([k for k, _v in c.items() if _v == v])
    return "\n".join(l)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
import collections

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

c = collections.Counter(s)
c_s = c.most_common()
m = c.most_common()[0][1]
ans = []
for j in range(len(c_s)):
    if c_s[j][1] != m:
        break
    else:
        ans.append(c_s[j][0])
ans.sort()
for t in ans:
    print(t)
from collections import Counter

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

ctr = Counter(S)
cnt_max =  max(ctr.values())

for s, c in sorted(ctr.items(), key=lambda x: (-x[1], x[0])):
    if c == cnt_max:
        print(s)
from collections import Counter

N = int(input())
c = Counter([input() for _ in range(N)])
mv = max(c.values())
[print(w) for w in sorted(c.keys()) if c[w] == mv]
N = int(input())
S = [input() for _ in range(N)]
c = {}

for s in S:
    if c.get(s):
        c[s] += 1
    else:
        c[s] = 1


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

print('\n'.join(sorted(map(lambda x: x[0], filter(lambda x: x[1] == n_max, s_items)))))
n=int(input())
s=[input() for i in range(n)]
s.sort()
b=list(set(s))
b.sort()
a=s[0]
m=[0]
for i in range(n):
  if s[i]!=a:
    m.append(i)
    a=s[i]
m.append(n)
o=[]
for i in range(len(m)-1):
  o.append(m[i+1]-m[i])
num=max(o)
for i in range(len(o)):
  if o[i]==num:
    print(b[i])
n = int(input())

vote = {}

for i in range(n):
  s = input()
  if s in vote.keys():
    vote[s] += 1
  else:
    vote[s] = 1
m = max(vote.values())
vote=sorted(vote.items() , key = lambda x:x[0])
for i in vote:
  if i[1] == m:
    print(i[0])
n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)
from collections import defaultdict
n = int(input())
dic = defaultdict(int)
for i in range(n):
    dic[input()] += 1
tmp = [(key, value) for key, value in dic.items()]
tmp.sort(key=lambda x: (x[1], x[0]))
m = tmp[-1][1]
for i in range(len(dic)):
    if tmp[i][1] == m:
        print (tmp[i][0])
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
m = c.most_common()[0][1]
l = []
for i in c.keys():
    if c[i] == m:
        l.append(i)
l.sort()
print(*l, sep="\n")
number = int(input())
words = {}
answer = []
maxnum = 0
for i in range(number):
    word = input()
    if word in words:
        words[word] += 1
    else:
        words[word] = 1
    if maxnum < words[word]:
        maxnum = words[word]
        answer.clear()
        answer.append(word)
    elif maxnum == words[word]:
        answer.append(word)
answer.sort()
for j in range(len(answer)):
    print(answer[j])
import collections

N = int(input())
c = collections.Counter(input() for _ in range(N))

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

a = []
for i in c:
    if c[0][1] != i[1]: break
    a.append(i)

a = sorted(a)
for i in a:
    print(i[0])
n = int(input())
s = [str(input()) for _ in range(n)]
s.append('zzzzzzzzzzz')
s.sort()

l_cnt = []
c_max = 1
cnt = 1
bfo = 'xxxxxxxxxxx'

for i in s:
    if i == bfo:
        cnt += 1
        c_max = max(c_max, cnt)
    else:
        l_cnt.append([bfo, cnt])
        bfo = i
        cnt = 1

for j in range(len(l_cnt)):
    if j == 0:
        continue
    else:
        if c_max == l_cnt[j][1]:
            print(l_cnt[j][0])
N = int(input())
d = {}
for i in range(N):
    S = input()
    if S in d.keys():
        d[S] += 1
    else:
        d[S] = 1
max_val = max(d.values())
key_list = [kv[0] for kv in d.items() if kv[1] == max_val]
for k in sorted(key_list):
    print(k)
import collections
n = int(input())
a=[input() for _ in range(n)]
anslist=[]
b=collections.Counter(a)
c=max(list(b.values()))
for i in b:
    if b[i]==c:
        anslist.append(i)
d=sorted(anslist)
for i in tuple(d):
    print(i)
# -*- coding: utf-8 -*-
N = int(input())
S = list()
words = {}
for i in range(N):
  s = input()
  S.append(s)
  if s in words:
    words[s] += 1
  else:
    words[s] = 1

max_value = max(words.values())
max_list = list()
for k,v in words.items():
  if v == max_value:
    max_list.append(k)
ans_list = sorted(max_list)
for ans in ans_list:
  print(ans)
import collections
n = int(input())
s = collections.Counter([input() for i in range(n)])

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

len = counts.count(max(counts))
values = sorted(values[:len])

for i in range(len):
    print(values[i])
n = int(input())

dic = {}

for x in range(n):
    a = input()
    dic.setdefault(a,0)
    dic[a] += 1

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

max_word = [k for k,v in dic2 if v == dic2[0][1] ]

max_word.sort()

for x in max_word:
    print(x)
import collections

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

#c = collections.Counter(List)

c = {}

for i in range(n):
    if List[i] in c.keys():
        c[List[i]] += 1
    else:
        c[List[i]] = 1


m = 0
for v in c.values():
    m = max(m, v)

for k, v in c.items():
    if v == m:
        res.append(k)
    
res.sort()
for i in range(len(res)):
    print(res[i])
N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic[word] = 1
    
  else:
    
    if max == dic[word]:
      max += 1
    dic[word] += 1

candidates = sorted([word for word in dic.keys() if dic[word] == max])
for word in candidates:
  print(word)
import collections

n=int(input())
s=['' for _ in range(n)]
ans=[]
for i in range(n):
  x=input()
  s[i]=x
c = collections.Counter(s)
l=c.most_common()
r=len(list(set(s)))
cnt=l[0][1]
l.sort(key=lambda x: x[0])
for i in range(r):
  if cnt==l[i][1]:
    print(l[i][0])
import sys
from collections import Counter
input = sys.stdin.readline

n = int(input())
s = [str(input().rstrip()) for _ in range(n)]
c = Counter(s)
d_sorted = sorted(c.items(), key=lambda x:x[1], reverse=True)

m = d_sorted[0][1]
ans = []
for key, v in d_sorted:
    if v == m:
        ans.append(key)
ans.sort()
print("\n".join(ans))
import collections

N = int(input())
S = []
for _ in range(N):
  S += [input()]
d = collections.Counter(S).most_common()

for i in sorted([k for k, v in d if v == d[0][1]]):
  print(i)
import sys 
from collections import Counter

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
l = read().decode().split()
c = Counter(l)

max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]

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

cnt={}
ans=[]

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

m=max(cnt.values())
key = sorted(cnt.keys())

for a in key:
    if cnt[a] == m:
        print(a)
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    counter+=[count]
    count=1
    
counter+=[count]    
MAX=max(counter)
count=1

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    count=1
  if count==MAX:
    print(listS[i])
    
if MAX==1:
  print(listS[-1])
# 解き直し
from collections import defaultdict
N = int(input())
c = defaultdict(int)
for _ in range(N):
    s = input()
    c[s] += 1
max_cnt = max(c.values())

anss = []
for k, v in c.items():
    if v == max_cnt:
        anss.append(k)

for ans in sorted(anss):
    print(ans)
n = int(input())
sub = dict()
ans = 0
for i in range(n):
  key = input()
  if key in sub:
    sub[key] = sub[key] + 1
    if ans < sub[key]:
      ans = sub[key]
  else:
    sub[key] = 1
    if ans < sub[key]:
      ans = sub[key]
      
sub = sorted(sub.items())

for i in range(len(sub)):
  if sub[i][1] == ans:
    print(sub[i][0])
import os, sys, re, math

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

d = {}
for s in S:
    if not s in d:
        d[s] = 0
    d[s] += 1

d = sorted(d.items(), key=lambda x:x[1], reverse=True)
names = [v[0] for v in d if v[1] == d[0][1]]

for name in sorted(names):
    print(name)
def main():

    N = int(input())
    d = dict()
    cnt = 0
    for _ in range(N):
        s = input()
        d[s] = d.get(s, 0) + 1
        cnt = max(cnt, d[s])
    ans = []
    for s in d:
        if d[s] == cnt: ans.append(s)
    ans = sorted(ans)
    for s in ans:
        print(s)

    # return " ".join(map(str, sorted(ans)))

if __name__ == '__main__':
    main()
    # print(main())
import sys
sys.setrecursionlimit(10**6)

n = int(input())
d = {}

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

max_v = max(d.values())
kv_list = [kv for kv in d.items() if kv[1] == max_v]
kv_list.sort()
for kv in sorted(kv_list):
    print(kv[0])
from collections import OrderedDict
import sys
input = sys.stdin.readline

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

    count = OrderedDict()
    for _ in range(n):
        name = input()
        if name not in count.keys():
            count[name] = 1

        else:
            count[name] += 1

    count = OrderedDict(
        sorted(count.items(), key=lambda x: x[0])
    )
    max_polls = max(count.values())

    for k, v in count.items():
        if v == max_polls:
            print(k)
            
resolve()
N = int(input())
dic = {}

for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1
    
max_N = max(list(dic.values()))
keys = sorted([k for k, v in dic.items() if v == max_N])

print("\n".join(keys))
from collections import Counter

n=int(input())
s=[input() for i in range(n)]
a=Counter(s)
b=a.most_common()
c=list(a.values())
d=max(c)
e=[]

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

e=sorted(e)
for i in range(len(e)):
    print(e[i])
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
mv = max(dic.values())
for s, v in sorted(dic.items()):
    if v == mv:
        print(s)
n = int(input())
s = []
for i in range(0,n):
    s.append(input())
s.sort()
b = [0] * (n - 1)
for i in range(0,n-1):
    if s[i] == s[i+1]:
        b[i] = 1
j = n-2
while j > 0:
    if b[j-1] != 0:
        b[j-1] += b[j]
    j-=1
max = 0
for i in range(0,n-1):
    if b[i] > max:
        max = b[i]
for i in range(0,n-1):
    if b[i] == max:
        print(s[i])
if b[n-2] == 0:
    print(s[n-1])
import collections
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    S = [input() for _ in range(n)]
    word = collections.Counter(S).most_common()
    maxi = word[0][1]
    ans = []
    for w in word:
        if w[1] == maxi:
            ans.append(w[0])
        else:
            break
    ans.sort()
    a = "\n".join(ans)
    print(a)

if __name__ == '__main__':
    main()
n=int(input())
L={}
c=0
for i in range (n):
    s=input()
    if s in L:
        L[s]+=1
    else:
        L.update({s:1})
        c+=1
M=list(L.values())
C=list(L.keys())
b=max(M)
F=[]
for i in range(c):
    if M[i]==b:
        F+=[C[i]]
F.sort()
for i in F:
    print(i)
from collections import Counter
n = int(input())
a = [input() for i in range(n)]
c = Counter(a)
m = c.most_common()[0][1]
ans = []
for i,x in c.items():
  if x == m:
    ans.append(i)
ans.sort()
print(*ans,sep="\n")
# coding: utf-8
# Your code here!
import sys
from collections import Counter
import numpy as np
n=int(input())
S=[]
for i in range(n):
    S.append(input())
s=Counter(S)
keys, values = zip(*s.most_common())

values=np.array(values)
index=np.where(values==np.max(values))
answer=[]
for i in index[0]:
    answer.append(keys[i])
answer.sort()
for i in answer:
    print(i)
n = int(input())

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

s_dict = dict()
for _s in s:
    s_dict[_s] = 0

for _s in s:
    s_dict[_s] += 1

max_frequency = max(s_dict.values())

s_ans_list = [_s for _s, i in zip(s_dict.keys(), s_dict.values()) if i >= max_frequency]
s_ans_list = sorted(s_ans_list)

for _s in s_ans_list:
    print(_s)
from collections import defaultdict

n = int(input())
l = defaultdict(int)
m = 0
for _ in range(n):
    s = input()
    l[s] += 1
    m = max(m, l[s])

ans = []
for k, v in l.items():
    if v == m:
        ans.append(k)
ans.sort()
for s in ans:
    print(s)
from collections import defaultdict

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

dic = defaultdict(int)
for each in li:
    dic[each] += 1

res = sorted(dic.items(), key=lambda x:x[1], reverse=True)
max_val = 0
res_li = []
for name, val in res:
    if val >= max_val:
        max_val = val
    if max_val == val:
        res_li.append(name)

res_li.sort()
for each in res_li:
    print(each)
import collections
from collections import Counter

n = int(input())
ls = [input() for i in range(n)]    
c = Counter(ls).most_common()

count = c[0][1]
ans = []

for i in range(len(c)):
    if c[i][1] == count:
        ans.append(c[i][0])
    else:
        break   
ans = sorted(ans)
for i in ans:
    print(i)
n = int(input())
s = [input() for _ in range(n)]

ans = {}
for t in s:
    if t in ans:
        ans[t] += 1
    else:
        ans[t] = 1

max_cnt = max(ans.values())

for t in sorted(ans):
    if ans[t] == max_cnt:
        print(t)
N = int(input())
S = [input() for _ in range(N)]
dic = dict()
for s in S:
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
score_sorted = sorted(dic.items(), key=lambda x: -x[1])
m = score_sorted[0][1]
ret = []
for k,v in score_sorted:
    if v == m:
        ret.append(k)
    else:
        break
ret = sorted(ret)
for item in ret:
    print(item)
n = int(input())
d = {}
for i in range(n):
    s = input()
    if s in d.keys():
        d[s] += 1
    else:
        d[s] = 1
x = 0
for i in d.keys():
    x = max(x,d[i])
d = sorted(d.items())
for i in d:
    if i[1] == x:
        print(i[0])
from collections import defaultdict
N = int(input())
touhyou = defaultdict(int)
for _ in range(N):
    s = input()
    touhyou[s] +=1
touhyou1=dict(sorted(touhyou.items(),key = lambda x: x[1],reverse = True))
maxn=max(touhyou1.values())
ans=[]
for key,val in zip(touhyou1.keys(),touhyou1.values()):
    if val == maxn:
        ans.append(key)

ans=sorted(ans)

for i in range(len(ans)):
    print(ans[i])
from collections import Counter
n = int(input())
s = Counter([str(input()) for _ in range(n)])
m = max(s.values())
for x in sorted(x for x in s if s[x] == m):
    print(x)
n = int(input())
S = [input() for _ in range(n)]

from collections import Counter

C = Counter(sorted(S))

ans = []
numMax = C.most_common()[0][1]
for key, num in C.most_common():
    if num == numMax:
        ans.append(key)
[print(a) for a in sorted(ans)]
dict={}
n=int(input())
for i in range(n):
    s=input()
    if s in dict:
        dict[s]+=1
    else:
        dict.setdefault(s,0)
itemMaxValue = max(dict.items(), key=lambda x: x[1])
listOfKeys = []

for key, value in dict.items():
    if value == itemMaxValue[1]:
        listOfKeys.append(key)
        
listOfKeys.sort()
for x in listOfKeys:
    print(x)
n = int(input())

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

import collections
import itertools

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

# print(*(k for k, v in it))
B = []
for k, v in it:
    B.append(k)
B = sorted(B)
for i in B:
    print(i)
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]
    elif a_dict[s] == max_val:
      max_key_list.append(s)
max_key_list.sort()
for s in max_key_list:
  print(s)
from collections import Counter
import sys
input=sys.stdin.readline
n=int(input())
s=[input().rstrip() for _ in range(n)]
C=Counter(s).most_common()
f=C[0][1]
t=[]
for k,v in C:
	if v<f:
		break
	t.append(k)
print(*sorted(t),sep="\n")
import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.Counter(s)
l=c.most_common()
k=l[0][1]
l1=[]
for i in range(len(l)):
    if l[i][1]==k:l1.append(l[i][0])
    else:break
l1.sort()
for i in range(len(l1)):
    print(l1[i])
import collections
import heapq

n = int(input())
l = [input() for _ in range(n)]
c = collections.Counter(l)
max_count = 0
ans = []
for word, count in c.most_common():
  if(max_count <= count):
    heapq.heappush(ans, word)
    max_count = count
  else:
    break
for _ in range(len(ans)):
  print(heapq.heappop(ans))
N = int(input())
S = []
for _ in range(N):
    S.append(input())

import sys
from collections import Counter

count_dict = Counter(S)
most_freq = count_dict.most_common(1)[0][1]

words = []

for word, freq in sorted(count_dict.items(), key=lambda x: -x[1]):
    if freq == most_freq:
        words.append(word)

for word in sorted(words):
    print(word)
n=int(input())
s={}
ans=[]
max=0
for i in range(n):
    st=input()
    if st in s:
        s[st]+=1
    else:
        s[st]=1
    if max<s[st]:
        max=s[st]
        ans=[st]
    elif max==s[st]:
        ans.append(st)
ans.sort()
for i in ans:
    print(i)
N = int(input())
stats = {}
for i in range(N):
  s = input()
  if s not in stats:
    stats[s] = 1
  else:
    stats[s] += 1
max = max(stats.values())
out = sorted([name for name, num in stats.items() if num == max])
for i in out:
  print(i)