Problem:
 Score: 300 points    Problem Statement  We have N voting papers. The i -th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.      Constraints   1 \leq N \leq 2 \times 10^5  S_i  (1 \leq i \leq N) are strings consisting of lowercase English letters.  The length of S_i  (1 \leq i \leq N) is between 1 and 10 (inclusive).         Input  Input is given from Standard Input in the following format:  N  S_1  :  S_N       Output  Print all strings in question in lexicographical order.        Sample Input 1 7
beat
vet
beet
bed
vet
bet
beet      Sample Output 1 beet
vet  beet and vet are written on two sheets each, while beat , bed , and bet are written on one vote each. Thus, we should print the strings beet and vet .       Sample Input 2 8
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo      Sample Output 2 buffalo       Sample Input 3 7
bass
bass
kick
kick
bass
kick
kick      Sample Output 3 kick       Sample Input 4 4
ushi
tapu
nichia
kun      Sample Output 4 kun
nichia
tapu
ushi

Solution (Python):
import collections
N = int(input())
S = [input() for i in range(N)]

c = collections.Counter(S)
value,count = zip(*c.most_common())

s = sorted(value)
ans = []
if len(set(count)) == 1 :
    for i in s:
        print(i)
else: 
    for i in range(len(value)):
        ans.append(value[i])
        if count[i] > count[i+1]:
            [print(i) for i in sorted(ans)]
            exit()

Solution (Python):
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)

Solution (Python):
from collections import Counter
N = int(input())
S = [input() for i in range(N)]

S_c = Counter(S)
max_count = max(S_c.values())

ans = []

for key, value in S_c.items():
  if value == max_count:
    ans.append(key)
    
ans.sort()

for i in range(len(ans)):
  print(ans[i])

Solution (Python):
from collections import defaultdict
N=int(input())
ans=[]
d=defaultdict(int)
for _ in range(N):
    d[input()]+=1
maxv=max(d.values())
for i in d.keys():
    if d[i]==maxv:
        ans.append(i)
ans.sort()
[print(i) for i in ans]

Solution (Python):
from collections import defaultdict
N=int(input())
ans=[]
d=defaultdict(int)
for _ in range(N):
    d[input()]+=1
maxv=max(d.values())
for i in d.keys():
    if d[i]==maxv:
        ans.append(i)
ans.sort()
[print(i) for i in ans]

Solution (Python):
N = int(input())
dic = {}
for _ in range(N):
    s = input()
    if not s in dic.keys():
        dic[s] = 0
    dic[s]+=1
list2 = sorted(dic.items(),key=lambda x:-x[1]) 

max1 = list2[0][1]
anslist = []
for d in list2:
    if d[1] == max1:
        anslist.append(d[0])
    else:
        break

anslist2 = sorted(anslist,key=lambda x:x)
for d in anslist2:
    print(d)

Solution (Python):
N=int(input())
li=[]
import collections

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

li.sort()

c=collections.Counter(li)
cl=c.values()
m=max(cl)
keys=[k for k,v in c.items() if v==m]
keys.sort()

for j in range(len(keys)):
    print(keys[j])

Solution (Python):
import math
import collections

class abc_155:
    
    def __init__(self):
        pass
    
    def A(self):
       pass
    def B(self):
        pass
        
    def C(self):
        N=int(input())
        S=[input() for i in range(N)]
        c=collections.Counter(S).most_common()
        ans=[]
        ans.append(c[0][0])
        roop=c[0][1]
        
        for i in range(1,len(c)):
            if roop==c[i][1]:ans.append(c[i][0])
            else:break
        ans.sort()
        for i in ans:print(i)
                
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_155()
    obj.C()

Solution (Python):
from collections import Counter
N = int(input())
S = [str(input()) for _ in range(N)]

SC = Counter(S)
max_count = max(SC.values())

ans = []

for key,value in SC.items():
  if value == max_count:
    ans.append(key)

ans.sort()

for i in range(len(ans)):
  print(ans[i])

Solution (Python):

















def main():

    N = int(input())
    d = dict()

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

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

    l = -1
    ans = []
    for k, v in d:
        if v < l:
            break
        else:
            l = v
            ans.append(k)

    
    ans.sort()
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter

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

dic = Counter(S)

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

for v in ans:
    print(v)

Solution (Python):
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]

sc=Counter(s).most_common()
max_idx=sc[0][1]

ans=[]
for i,j in sc:
  if j==max_idx:
    ans.append(i)

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

Solution (Python):

import math


def inp():
    return(int(input()))



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



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


N = inp()
count = dict()
while N:
    s = input()
    if s in count:
        count[s] += 1
    else:
        count[s] = 1
    N -= 1
m = max(count.values())
res = []
for key, value in count.items():
    if value == m:
        res.append(key)
res = sorted(res)
for i in res:
    print(i)

Solution (Python):
from collections import defaultdict
n = int(input())
dics = defaultdict(int)
for i in range(n):
    s = input()
    dics[s] += 1
max_v = max(dics.values())
max_k_list = [kv[0] for kv in dics.items() if kv[1] == max_v]
max_k_list.sort()
print(*max_k_list, sep='\n')

Solution (Python):
import collections
n = int(input())
l = []
s = collections.Counter([input() for i in range(n)])
mn = 0
for i in s.most_common():
    if i[1] >= mn:
        mn = i[1]
        l.append(i[0])
    else:
        break
for i in sorted(l):
        print(i)

Solution (Python):
import collections
N = int(input())
S = [input() for _ in range(N)]
C = collections.Counter(S)
MAX = 0
L = []
for c in C.most_common():
    if c[1] > MAX:
        MAX = c[1]
        L = [c[0]]
    elif c[1] == MAX:
        L.append(c[0])
for l in sorted(L):
    print(l)

Solution (Python):
N=int(input())
dict={}
for i in range(N):
	s = input()
	if s in dict:dict[s]+=1
	else:dict[s]=1
max_count = max(dict.values())
for k,v in sorted(dict.items()):
	if v==max_count:print(k)

Solution (Python):
N = int(input())
A={}
for i in range(N):
    tmp=input()
    if tmp in A:
        A[tmp]+=1
    else:
        A[tmp]=1
        
B=max(A.values())
keys = [k for k, v in A.items() if v == B]
nk=sorted(keys)

print(*nk,sep='\n')

Solution (Python):
import collections
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    coll = collections.Counter(S)
    maxval = max(coll.values())
    ans = []
    for k,v in coll.most_common():
        if v!=maxval:
            break
        ans.append(k)
    print(*sorted(ans), sep="\n")

main()

Solution (Python):
def main():
    n = int(input())
    a = [input() for _ in range(n)]
    
    d = {}
    for i in a:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    m = max(d.values())
    for k, v in sorted(d.items()):
        if v == m:
            print(k)
    
if __name__ == '__main__':
    main()

Solution (Python):
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")

Solution (Python):
from collections import Counter

N = int(input())
counter = Counter()

max_count = 0
for _ in range(N):
    s = input()
    counter[s] += 1
    max_count = max(max_count, counter[s])

results = sorted([k for k, v in counter.items() if v == max_count])
print('\n'.join(results))

Solution (Python):
from collections import Counter

N = int(input())
counter = Counter()

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

max_count = max(counter.values())

results = sorted([k for k, v in counter.items() if v == max_count])
print('\n'.join(results))

Solution (Python):
from collections import Counter
N = int(input())
S = Counter([input() for i in range(N)])
most = S.most_common()[0][1]
ans = []
for name, num in S.items():
  if num != most:
    continue
  ans.append(name)
ans.sort()
for a in ans:
  print(a)

Solution (Python):
n = int(input())

import collections

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

D = []
for k, v in sorted(c.items(), key=lambda x: -x[1]):
    D.append([k,v])
sortsecond = lambda val : -val[1]
D.sort(key=sortsecond)

E = []
for i in range(len(D)):
    if D[0][1] == D[i][1]:
        E.append(D[i][0])
    else:
        break
E = sorted(E)
for i in range(len(E)):
    print(E[i])

Solution (Python):
n = int(input())
s = []
while True:
    try:
        s.append(input())
    except EOFError:
        break

word_counter = {}
for word in s:
    if word in word_counter:
        word_counter[word] += 1
    else:
        word_counter[word] = 0

results = sorted(word_counter.items(), key=lambda x: x[1], reverse=True)
max_v = results[0][1]

pick_ups = [result[0] for result in results if result[1] == max_v]
sorted_pick_ups = sorted(pick_ups)
print(*sorted_pick_ups, sep='\n')

Solution (Python):

def resolve():
    n=int(input())
    dic={}
    for _ in range(n):
        s=input()
        if not s in dic.keys():
            dic[s]=0
        else:
            dic[s]+=1
    m=max(dic.values())
    ans=[]
    for each in dic.keys():
        if dic[each]==m:
            ans.append(each)
    for each in sorted(ans):
        print(each)
resolve()

Solution (Python):

n = int(input())
dic = {}
lis = []
lis2 = []

for i in range(n):
  moji = input()
  if moji not in dic:
    dic[moji] = 0
  dic[moji] += 1
  
for i in sorted(dic.items(), key=lambda x:x[1]):
    lis.append(i)
  
lis.reverse()

for j in lis:
  if lis[0][1] == j[1]:
    lis2.append(j[0])
  else:
    break

lis2.sort()
for i in range(len(lis2)):
  print(lis2[i])

Solution (Python):
n = int(input())
dic = {}
lis = []
lis2 = []

for i in range(n):
  moji = input()
  if moji not in dic:
    dic[moji] = 0
  dic[moji] += 1
  
for i in sorted(dic.items(), key=lambda x:x[1]):
    lis.append(i)
  
lis.reverse()

for j in lis:
  if lis[0][1] == j[1]:
    lis2.append(j[0])
  else:
    break

lis2.sort()
for i in range(len(lis2)):
  print(lis2[i])

Solution (Python):
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(k[0][0])
for i in range(len(collections.Counter(s))-1):
    if k[i][1]==k[i+1][1]:
        p.append(k[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Solution (Python):

def resolve():
    n=int(input())
    dic={}
    for _ in range(n):
        s=input()
        if not s in dic.keys():
            dic[s]=0
        else:
            dic[s]+=1
    m=max(dic.values())
    ans=[]
    for each in dic.keys():
        if dic[each]==m:
            ans.append(each)
    for each in sorted(ans):
        print(each)
resolve()

Solution (Python):
from collections import defaultdict

n = int(input())

s_dict = defaultdict(int)
for _ in range(n):
    s = input()
    s_dict[s] += 1

count_max = max(s_dict.values())
s_list = sorted([s for s, count in s_dict.items() if count == count_max])
print("\n".join(s_list))

Solution (Python):
from collections import defaultdict

n = int(input())

s_dict = defaultdict(int)
for _ in range(n):
    s = input()
    s_dict[s] += 1

count_max = max(s_dict.values())
s_list = sorted([s for s, count in s_dict.items() if count == count_max])
for s in s_list:
    print(s)

Solution (Python):
from collections import defaultdict
n = int(input())
s_dict = defaultdict(int)
for _ in range(n):
    s_dict[input()] += 1
count_max = sorted(s_dict.values())[-1]
s_list = sorted([s for s, count in s_dict.items() if count == count_max])
for s in s_list:
    print(s)

Solution (Python):
from collections import defaultdict
from operator import itemgetter

n = int(input())

s_dict = defaultdict(int)
for _ in range(n):
    s = input()
    s_dict[s] += 1

def multisort(xs, specs):
    for key, reverse in reversed(specs):
        xs.sort(key=itemgetter(key), reverse=reverse)
    return xs

s_list = multisort(list(s_dict.items()), ((1, True), (0, False)))
count_max = s_list[0][1]
for s, count in s_list:
    if count < count_max:
        break
    print(s)

Solution (Python):
n = int(input())
a = [input() for i in range(n)]
a.sort()
b =[]
k = 1
tmp = 1
d = 0
for i in range(n):
    if(i == 0):
        d = a[i]
        continue;
    if(a[i] != d):
        if(tmp == k):
            b.append(d)
        elif(tmp > k):
            k = tmp
            b = []
            b.append(d)
        tmp = 0
    tmp += 1
    d = a[i]

    if(i == n-1):
        if(tmp == k):
            b.append(a[i])
        elif(tmp > k):
            k = tmp
            b = []
            b.append(a[i])

for i in range(len(b)):
    print(b[i])

Solution (Python):
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())
for s in sorted(k for k in d if d[k] == m):
    print(s)

Solution (Python):
N = int(input())
M = { }
for i in range(N):
  S = input()
  if S not in M:
    M[S] = 0
  M[S] += 1

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)

Solution (Python):
count = 0
ans = []
dic = {}
n = int(input())
for i in range(n):
    s = input()
    number = dic.get(s, 0) + 1
    count = max(count, number)
    dic[s] = number
for key in dic:
    if dic[key] == count:
        ans.append(key)
ans.sort()
for k in ans:
    print(k)

Solution (Python):
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))

Solution (Python):
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()
for i in li:
    print(i)

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
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 LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]

def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]

def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

N = I()
d = {}
for i in range(N):
    s = ST()
    d[s] = d.get(s,0)+1
    max_i = 0
for k,i in d.items():

    if i>max_i:
        ans = [k]
        max_i = i
    elif i == max_i:
        ans.append(k)
ans.sort()
for i in ans:
    print(i)

Solution (Python):
N = int(input())
S = [input() for _ in range(N)]
from collections import Counter
c = Counter(S)
name = []
num = 0
for k,v in c.items():
    if v>num:
        num = v
        name = [k]
    elif v == num:
        name.append(k)
n_sort = sorted(name)
for i in range(len(n_sort)):
    print(n_sort[i])

Solution (Python):

from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
cnt = Counter(s)
m = max(cnt.values())
ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
print(*sorted(ans), sep="\n")

Solution (Python):
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
 
count = Counter(s)
maxNum = max(count.values())
t = sorted(list(set(s)))
for i in t:
  if count[i] == maxNum:
    print(i)

Solution (Python):
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

count = Counter(s)
maxNum = max(count.values())
t = sorted(list(set(s)))
for i in t:
  if count[i] == maxNum:
    print(i)

Solution (Python):
n = int(input())
d = {}
for _ in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1

sorted_d = sorted(d.items(), key=lambda x:x[1], reverse=True)
ma = sorted_d[0][1]

res = []

for i in range(len(sorted_d)):
    if sorted_d[i][1] == ma:
        res.append(sorted_d[i][0])

res.sort()

for i in range(len(res)):
    print(res[i])

Solution (Python):
from collections import defaultdict

n = int(input())

d = defaultdict(int)
for _ in range(n):
    d[input()] += 1

ans = sorted(sorted(d.items()), key=lambda x:x[1], reverse=True)
max_v = ans[0][1]
for s, v in ans:
    if v < max_v:
        break
    print(s)

Solution (Python):
n = int(input())
d = dict()

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

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

max = ans[0][1]
for i in ans:
    if i[1] < max:
        break
    print(i[0])

Solution (Python):
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)]

Solution (Python):
n = int(input())
li = []
lia = []
ans = 0
f = 1
li.insert(0,"0")
for i in range(n):
    li.append(input())
li.sort()
for i in range(n):
    if li[i] == li[i+1]:
        f += 1
    else:
        f = 1
    if f == ans:
        lia.append(li[i+1])
    if f > ans:
        lia = []
        ans = f
        lia.append(li[i+1])
for i in range(len(lia)):
    print(lia[i])

Solution (Python):
from collections import Counter
n = int(input())
s = []
ans = []

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

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

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)

Solution (Python):
from collections import Counter

n, *s = open(0).read().split()

c = Counter(s)
max_poll = c.most_common()[0][1]
candidates = []
for tpl in c.most_common():
    if tpl[1] == max_poll:
        candidates.append(tpl[0])

candidates.sort()

for candidate in candidates:
    print(candidate)

Solution (Python):
from collections import Counter
N = int(input())
L = [str(input()) for i in range(N)]
Lc = Counter(L).most_common()
Llist = []             
L_max = Lc[0][1]       
i = 0
while True:
  Llist.append(Lc[i][0])
  if i<len(Lc)-1 and Lc[i+1][1]==L_max:
    i+=1
  else:
    break
print("\n".join(sorted(Llist)))

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

from collections import Counter
c = Counter(s).most_common()
l =[c[0][0]]
for i in range(1,len(c)):
    if c[i][1]==c[0][1]:
        l.append(c[i][0])
l = sorted(l)
for j in range(len(l)):
    print(l[j])

Solution (Python):
N = int(input())
S = {}
for i in range(N):
    tmp = input()
    if tmp in S:
        S[tmp] += 1
    else:
        S[tmp] = 1

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

for i in range(len(keys)):
    print(keys[i])

Solution (Python):
n=int(input())
ss=set()
d=dict()
for ii in range(n):
  s=input()
  if s in ss:
    d[s]+=1
  else:
    ss.add(s)
    d[s]=1
ss=list(ss)
ss.sort()
mx=max(d.values())
for ii in ss:
  if d[ii]==mx:
    print(ii)

Solution (Python):
n = int(input())

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



max_s_val = max(s.values())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[i])

Solution (Python):
from collections import Counter

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

counter = Counter(s)
count = counter.most_common()
most = count[0][1]

c = []
for i in range(len(count)):
    if most == count[i][1]:
        c.append(count[i][0])

c.sort()
print(*c, sep='\n')

Solution (Python):
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)

Solution (Python):
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

max_value = max(s_dic.values())
s_dic = sorted(s_dic.items(), key=lambda x:x[0])

for i in s_dic:
    if i[1] == max_value:
        print(i[0])

Solution (Python):
n=int(input())
dict={}
for i in range(0,n):
  temp=str(input())
  if temp in dict:
    dict[temp]=dict[temp]+1
  else:
    dict[temp]=1
temp=max(dict.values())
max_list=[dict[0] for dict in dict.items() if dict[1]==temp] 
max_list.sort()
for i in range(0,len(max_list)):
  print(max_list[i])

Solution (Python):
import math
import queue
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1


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

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

ans = []

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

ans.sort()

for i in range(len(ans)):
	print(ans[i])

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
s = dict()

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

ss = sorted([(_[1], _[0]) for _ in s.items()])[::-1]

mx = ss[0][0]

ssr = []
for ssi in ss:
  if ssi[0] == mx:
    ssr.append(ssi[1])
sss = sorted(ssr)

for sssi in sss:
  print(sssi)

Solution (Python):

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

c = collections.Counter(s)
ret = []
tmp = []
max_v = max(c.values())

for k, v in c.most_common():
  if max_v == v:
    ret.append(k)
  else:
    break

for r in sorted(ret):
  print(r)

Solution (Python):
n = int(input())
s = [input() for _ in range(n)]
d = {}
for i in s:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1
vmax = max(d.values())
ans = [kv[0] for kv in d.items() if kv[1] == vmax]
ans.sort()
print('\n'.join(ans))

Solution (Python):
from collections import Counter

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

counter = Counter(S)
max_cnt = max(counter.values())
ans = [name for name, cnt in counter.items() if cnt == max_cnt]
ans.sort()
 
print(*ans, sep='\n')

Solution (Python):
N = int(input())
S_dict = {}
for i in range(N):
    s = input()
    if s not in S_dict:
        S_dict[s] = 1
    else:
        S_dict[s] += 1
        
max_poll = max(S_dict.values())
ans_list = []
for key, poll in S_dict.items():
    if poll == max_poll:
        ans_list.append(key)

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

Solution (Python):
N = int(input())
A = [input() for _ in range(N)]
dic = {}

for i in range(N):
  dic[A[i]] = 0
  
for i in range(N):
  dic[A[i]] += 1

k = max(dic.values())
dic = sorted(dic.items(), key=lambda x:x[0])
for el in dic:
  if el[1] == k:
    print(el[0])

Solution (Python):
import sys
from collections import Counter
input = sys.stdin.readline

N = int(input())
S = [input().strip('\n') for _ in range(N)]
c = Counter(S)
mx = 0

for k, v in c.items():
  mx = max(mx, v)

ans = []
for k, v in c.items():
  if mx == v:
    ans += [k]

ans = sorted(ans)
for k in ans:
  print(k)

Solution (Python):
import collections

N = int(input())
S_list = [None]*N
for i in range(N):
    S_list[i] = input()

dict_S = dict(collections.Counter(S_list))
max_count = max(dict_S.values())

max_list = []
for k, v in dict_S.items():
    if v == max_count:
        max_list.append(k)

sorted_max_list = sorted(max_list)
for i in range(len(max_list)):
    print(sorted_max_list[i])

Solution (Python):
n = int(input())
dic = {}
for i in range(n):
    w = input()
    if dic.get(w) is None:
        dic[w] = 1
    else:
        dic[w] += 1

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

maxn = ans[0][1]

ans = [x for x,y in ans if maxn==y]
ans.sort()
for i in ans:
    print(i)

Solution (Python):
n=int(input())




dic={}

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

mx=max(dic.values())
ansl=[]
for k, v in dic.items():
    if v==mx:
        ansl.append(k)

ansl.sort()

for st in ansl:
    print(st)

Solution (Python):
n=int(input())




dic={}

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

mx=max(dic.values())
ansl=[]
for k, v in dic.items():
    if v==mx:
        ansl.append(k)

ansl.sort()

for st in ansl:
    print(st)

Solution (Python):
import sys
from collections import Counter
N = int(sys.stdin.readline())
S = sys.stdin.read().split()

count = Counter(S)
max_num = max(count.values())
max_list = [i for i,j in count.items() if j==max_num]

max_list.sort()
print('\n'.join(max_list))

Solution (Python):
n = int(input())

d = {}

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

m = max(d.values())
d = sorted(d.items())

for j in d:
    if j[1] == m:
        print(j[0])

Solution (Python):
N = int(input())
S = {}
for n in range(N):
  s = input()
  if s not in S.keys():
    S[s] = 1
  else:
    S[s] += 1
m = max(S.values())
S2 = sorted(S)
for s in S2:
  if S[s] == m:
    print(s)

Solution (Python):
n=int(input())
l={}
ans=[]
for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l.setdefault(s,1)
max_l=max(l.values())

for i in l.keys():
  if l[i]==max_l:
    ans.append(i)
    
ans.sort()
 
for j in ans:
  print(j)

Solution (Python):
N=int(input())
h={}
for i in range(N):
  S=input()
  if S in h:
    h[S] += 1
  else:
    h[S]=0
result=sorted(h.items(), key=lambda x:x[1], reverse=True)
max_val=result[0][1]
keys = [k for k, v in h.items() if v == max_val]
for i in sorted(keys):
  print(i)

Solution (Python):
N = int(input())

S = {}

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

    if s not in S:
        S[s] = 1
    else:
        S[s] += 1
maxNum = 0
Smx = []
for s in S:
    if maxNum == S[s]:
       Smx.append(s)
    elif maxNum < S[s]:
        maxNum = S[s]
        Smx = [s]

for s in sorted(Smx):
    print(s)

Solution (Python):
n=int(input())
d={}
for i in range(n):
  s=input()
  if s not in d:
    d.setdefault(s,1)
    
  else:
    d[s]+=1
    
largest =max(d.values())
list_d=[]
for i in d.keys():
  if d[i]==largest:
    list_d.append(i)
    
list_d.sort()

for i in list_d:
  print(i)

Solution (Python):


d = {}
max_value = 1
n = int(input())
for i in range(n):
    t = input()
    if t in d.keys():
        d[t] += 1
        if d[t] > max_value:
            max_value = d[t]
    else:
        d.setdefault(t, 1)




d = sorted(d.items())

for k, v in d:
    if v == max_value:
        print(k)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
n = int(input())
l = [input() for _ in range(n)]
d ={}
for i in l:
    if i in d:
        d[i] +=1
    if i not in d:
        d[i] =1
        
dic = sorted(d.items(), key=lambda x:x[1],reverse=True)
a = dic[0][1]
lis = []
for j in dic:
    if j[1] == a:
        lis.append(j[0])
    else:
        break
        
answerlist = sorted(lis)
[print(i) for i in answerlist]