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 sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

a = []

for i in range(n):
    a.append(input())
a.sort()

aa = s(a)

aa.sort(key = lambda x:x[1],reverse = True)

for i in range(len(aa)):
    if i == 0:
        co = aa[i][1]
        print(aa[i][0],end = "")
    else:
        if aa[i][1] == co:
            print(aa[i][0],end = "")
        else:
            break

Solution (Python):
from collections import Counter

input = raw_input
n = int(input())
s_list = [input() for _ in range(n)]
counter = Counter(s_list)

max_val = max(counter.values())
outs = sorted([key for key, val in counter.items() if val == max_val])

for out in outs:
    print(out)

Solution (Python):
def main():
    N = int(input())
    m = {}
    for i in range(N):
        S = input()
        m.setdefault(S, 0)
        m[S] += 1
    L = list(m.items())
    L.sort(key=lambda x: x[1])
    max_freq = L[-1][1]
    I = []
    for k, v in m.items():
        if v == max_freq:
            I.append(k)
    I.sort()
    print('\n'.join(I))

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter
import sys


def read() -> str:
    return sys.stdin.readline().rstrip()


def main():
    n = int(read())
    s = [read() for _ in range(n)]
    counter = Counter(s).most_common()
    c = counter[0][1]
    print(*sorted(ci[0] for ci in counter if ci[1] == c), sep="\n")


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math
import bisect


def main():
    d = dict()
    for _ in range(int(input())):
        s = input()
        if s not in d:
            d[s] = 0
        d[s] += 1
    max_val = max(list(d.values()))
    '''
    print(d)
    print(max_val)
    '''
    A = []
    for a in d:
        if d[a] == max_val:
            A.append(a)
    A.sort()
    for a in A:
        print(a)

if __name__ == "__main__":
    main()

Solution (Python):
from collections import Counter
n = int(input())

s = [input() for i in range(n)]
c = Counter(s)
ans = []
cnt = 0
for k in sorted(c.keys()):
    if c[k] > cnt:
        ans = [k]
        cnt = c[k]
    elif c[k] == cnt:
        ans.append(k)
[print(i) for i in ans]

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

Solution (Python):
N = int(input())
S = [input() for i in range(N)]
from collections import Counter
ctr = Counter(S)
n = ctr.most_common()[0][1]

cands = []
for k in ctr.keys():
    if ctr[k] == n:
        cands.append(k)
cands.sort()
print(*cands, sep='\n')

Solution (Python):
n = int(input())
import collections
dat = []
for _ in range(n):
    dat.append(input())
c = collections.Counter(dat)
mcc = c.most_common(1)[0][1]

res = []
for k in c:
    if c[k] == mcc:
        res.append(k)
res.sort()
for i in range(len(res)):
    print(res[i])

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, S: "List[str]"):
    from collections import Counter
    c = Counter(S)
    ans = []
    t = c.most_common()[0][1]
    
    for k,v in c.most_common():
        if v == t:
            ans.append(k)

    
    ans.sort()
    for i in ans:
        print(i)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    S = [next(tokens) for _ in range(N)]  
    solve(N, S)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
s = [str(input()) for _ in range(n)]
s.sort()
t = list(set(s))
t.sort()
u = []
i = 0
j = 0
tmp = 0
while i < n:
    if s[i] == t[j]:
        tmp += 1
    else:
        u.append(tmp)
        tmp = 0
        j += 1
        i -= 1
    i += 1
u.append(tmp)
a = max(u)
for i in range(len(t)):
    if u[i] == a:
        print(t[i])

Solution (Python):
def main():
    n = int(input())
    words = {}
    for i in range(n):
        s = input()
        if s not in words.keys():
            words[s] = 0

        words[s] += 1

    counts = []
    for i in words.keys():
        counts.append((words[i],i))

    counts.sort()
    highest = []
    max_count = counts[-1][0]
    while counts and counts[-1][0] == max_count:
        highest.append(counts.pop()[1])

    highest.sort()
    for i in highest:
        print(i)

main()

Solution (Python):
N = int(input())
S = [input() for i in range(N)]
ans = {}
for s in S:
  ans[s] = ans.get(s, 0) + 1

m = max(ans.items(), key=lambda x: x[1])[1]
a = [s[0] for s in ans.items() if s[1] == m]
print(*sorted(a), sep="\n")

Solution (Python):
from collections import defaultdict
dd = defaultdict(int)

ma=0

N=int(input())
for i in range(N):
    S=input()
    dd[S]+=1
    if dd[S]>ma:
        ma=dd[S]
       
    
ans=[]   
for k,v in dd.items():
    if v==ma:
        ans.append(k)
        
ans.sort()

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

Solution (Python):


import sys
sys.setrecursionlimit(300000)


def solve(N: int, S: "List[str]"):
    c = {}
    for s in S:
        if not s in c:
            c[s] = 0
        c[s] += 1
    tmp =list( c.items())
    tmp.sort(key = lambda x: (-x[1], x[0]))
    ret = [tmp[0][0]]
    for i in range(1, len(tmp)):
        if tmp[i][1] == tmp[0][1]:
            ret.append(tmp[i][0])
        else:
            break
    for r in ret:
        print(r)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    S = [next(tokens) for _ in range(N)]  
    solve(N, S)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    from collections import defaultdict
    N = int(input())
    count = defaultdict(int)
    maxcnt = 0
    for _ in range(N):
        s = input()
        count[s] += 1
        maxcnt = max(maxcnt, count[s])
    ss = [s for (s, n) in count.items() if n==maxcnt]
    for s in sorted(ss):
        print(s)


if __name__ == '__main__':
    main()

Solution (Python):
a = int(input())
vote_dict = {}
for i in range(a):
    s = input()
    if s in vote_dict:
        vote_dict[s] += 1
    else:
        vote_dict[s] = 1
dic2 = sorted(vote_dict.items(), key=lambda x:x[1])
max_count = dic2[-1][1]
choose_list = []
for candidate in dic2:
    if(max_count == candidate[1]):
        choose_list.append(candidate[0])
print("\n".join(str(e) for e in sorted(choose_list)))

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

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

ans = []
for x in c:
    if x[1] == m:
        ans.append(x[0])
ans = sorted(ans)
for x in ans:
    print(x)

Solution (Python):
N = int(input())
from collections import defaultdict
dic = defaultdict(int)
for _ in range(N):
    S = input()
    dic[S] += 1

m = max(dic.values())
ls = sorted([k for k in dic if dic[k] == m])
for s in ls:
    print(s)

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

from collections import Counter

s = Counter(S)

k = s.most_common()

maxc = k[0][1]

l = []
for i in k:
    if i[1]<maxc:
        break
    else:
        l.append(i[0])

print(*sorted(l), sep="\n")

Solution (Python):
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
max_times = max(c.values())
keys = [key for key, value in c.items() if value == max_times]

keys = sorted(keys)
print('\n'.join(keys))

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

d = defaultdict(int)

for word in words:
    d[word] += 1

m = max(d.values())

tmp = [word for word, freq in d.items() if freq == m]
for word in sorted(tmp):
    print(word)

Solution (Python):
def main():
    N = int(input())
    S = {}
    for _ in range(N):
        s = input()
        if s not in S:
            S[s] = 0
        S[s] += 1
    maxCount = max(S.values())
    res = [s for s, ct in S.items() if ct == maxCount]
    res = sorted(res)
    for s in res:
        print(s)


    

main()

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

from collections import defaultdict
cnt=defaultdict(int)
maxcnt=0
for i in range(N):
  S=input()
  cnt[S]+=1
  if maxcnt<cnt[S]:
    maxcnt=cnt[S]

out=[]
keys=cnt.keys()
for k in keys:
  if cnt[k]==maxcnt:
    out.append(k)
    
out.sort()
n=len(out)
for i in range(n):
  print(out[i])

Solution (Python):
N = int(input())
dic = dict()
m = 0

for _ in range(N):
	S = str(input())
	if S in dic:
		dic[S] += 1
	else:
		dic[S] = 1
	m = max(m, dic[S])
		
a = list(dic.keys())
a.sort()

for t in a:
	if dic[t] == m:
		print(t)

Solution (Python):
from collections import Counter

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

C = Counter(S).most_common()
ans = []
m = C[0][1]
for i in range(len(C)):
    if C[i][1]==m:
        ans.append(C[i][0])
    else:
        break
ans.sort()
for a in ans:
    print(a)

Solution (Python):
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    d = defaultdict(int)
    for _ in range(n):
        d[input()] += 1
    max_v = max(d.values())
    d_sorted = sorted(d)

    for word in d_sorted:
        if d[word] == max_v:
            print(word)

if __name__ == '__main__':
    main()

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S):
    c = Counter(S)
    m = -1
    ans = []
    for s, n in c.most_common(n=N):
        if m == -1:
            m = n
            ans.append(s)
        else:
            if n == m:
                ans.append(s)
            else:
                break
    return '\n'.join(sorted(ans))


def main():
    N = read_int()
    S = [read_str() for _ in range(N)]
    print(slv(N, S))


if __name__ == '__main__':
    main()

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

c = list(c.items())
c.sort(reverse=True, key=lambda x: x[1])
mx = c[0][1]

ans = []
for k, v in c:
    if v == mx:
        ans.append(k)
    else:
        break

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

Solution (Python):
n = int(input())
S_dict = {}
for i in range(n):
    s = str(input())
    if s in S_dict.keys():
        S_dict[s] += 1
    else:
        new = {s:1}
        S_dict.update(new)

Ans = []
count = 0
for j in S_dict.values():
    count = max(j, count)

for key, value in S_dict.items():
    if value == count:
        Ans.append(key)

Ans = sorted(Ans)
for a in Ans:
    print(a)

Solution (Python):
from collections import Counter
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    s = list(set(S))
    c = Counter(S)
    maxc = max(c.values())
    ans = []
    for i in range(len(s)):
        if c[s[i]] == maxc:
            ans.append(s[i])
    ans.sort()
    for i in range(len(ans)):
        print(ans[i])


if __name__ == '__main__':
    main()

Solution (Python):
import sys
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = [S() for i in range(N)]
s = {}

tmp = 0
for i in range(N):
  if a[i] in s:
    s[a[i]] += 1
  else:
    s[a[i]] = 0
  tmp = max(tmp, s[a[i]])

ans = []
for i in range(N):
  if s[a[i]] == tmp:
    ans.append(a[i])
ans = list(set(ans))
ans.sort()
for i in ans:
  print(i)

Solution (Python):

import sys
input = sys.stdin.readline

n = int(input())
names = dict()
for _ in range(n):
    s = input().rstrip()
    if s not in names:
        names[s] = 1
    else:
        names[s] += 1

max_val = 0
for key in names.keys():
    if names[key] > max_val:
        max_val = names[key]
        ans = [key]
    elif names[key] == max_val:
        ans.append(key)

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

Solution (Python):
from sys import stdin
from itertools import groupby
n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]
li.sort()
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
lin.sort(key=lambda x:(x[1]*(-1),x[0]))
point = lin[0][1]
for i,j in lin:
    if j == point:
        print(i)
    else:
        break

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

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

from collections import Counter

c = Counter(S)

ans = []

max_count = max(c.values())

for i in c:
    if c[i] == max_count:
        ans.append(i)
ans.sort()

for j in ans:
    print(j)

Solution (Python):
from collections import Counter

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

sc = Counter(s).most_common()
maxi = sc[0][1]
ans = []
for i, j in sc:
    if j == maxi:
        ans.append(i)

ans = sorted(ans)
print(*ans)

Solution (Python):
N = int(input())
dicta = {}
for i in range(N):
    s = input()
    if s not in dicta:
        dicta[s] = 1
    else:
        dicta[s]+=1
maxv = max(dicta.values())
ans = []
for k,v in dicta.items():
    if v == maxv:
        ans.append(k)
ans.sort()
for i in ans:
    print(i)

Solution (Python):
from collections import Counter

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

c = Counter(s)
mx = max([v for v in c.values()])

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

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    cnt = {}
    max_num = 0
    for _ in range(N):
        s = input().rstrip('\n')
        if s not in cnt:
            cnt[s] = 1
        else:
            cnt[s] += 1
        if cnt[s] > max_num:
            max_num = cnt[s]

    ans = []
    for s in cnt:
        if cnt[s] == max_num:
            ans.append(s)
    ans.sort()
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

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

from collections import defaultdict
dd = defaultdict(int)

max_n = 0

for i in range(N):
    dd[S[i]]+=1
    max_n = max(max_n,dd[S[i]])

ans = []
for key in dd:
    if dd[key]==max_n:
        ans.append(key)

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

Solution (Python):



from collections import Counter
def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    ls = Counter()
    for i in range(n):
        s = input()
        ls[s] += 1
    m = -1
    ans = []
    for k, c in ls.most_common():
        if m == -1:
            m = c
        if c < m:
            break
        ans.append(k)
    ans.sort()
    for s in ans:
        print(s)


if __name__ == '__main__':
    main()

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1



n=int(input())
C=collections.Counter([input() for i in range(n)])
M=max(C.values())
S=[]
for e,i in  C.items():
  if i == M:
    S.append(e)
S.sort()
print(*S,sep="\n")

Solution (Python):
n = int(input())
d = {}
for i in range(n):
    s = input().strip()
    if s not in d: d[s] = 1
    else: d[s] += 1

t = max(d, key = lambda i : d[i])
print(*(sorted([i for i in d if d[i] == d[t]])), sep = '\n')

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

Solution (Python):
import sys
input = sys.stdin.readline
from collections import Counter
n=int(input())
S=[input() for _ in range(n)]
Sc=Counter(S)
Scm=Sc.most_common()
a,cnt=Scm[0]
ans=[]
for a,b in Scm:
    if b==cnt:
        ans.append(a)
    else:
        continue
ans.sort()
print(*ans, sep='\n')

Solution (Python):
n = int(input())
from collections import defaultdict
m = defaultdict(int)
for i in range(n):
  s = input()
  m[s] += 1
ma = sorted(m.values())[-1]
x = sorted(m.items())
for e in x:
  if e[1] == ma:
    print(e[0])

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    vn = vk = vn_k = 1
    for i in range(1, n+1):
        vn = vn * i % modp
        if i == k:
            vk = vn
        if i == n-k:
            vn_k = vn
    return vn * get_inv(vk, modp) * get_inv(vn_k, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp



def main():
    N=ii()
    d = defaultdict(int)
    for _ in range(N):
        d[input()]+=1
    m = max(d.values())
    ss = [s for s in d.keys() if d[s]==m]
    ss.sort()
    for s in ss:
        print(s)

main()

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

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

ans = []
cnt = 0
for i in memo:
    if memo[i] > cnt:
        ans = []
        cnt = memo[i]
        ans.append(i)
    elif memo[i] == cnt:
        ans.append(i)
    else:
        pass
ans = sorted(ans)
for string in ans:
    print(string)

Solution (Python):
from collections import Counter
N = int(input())
Ss = [input() for i in [0]*N]
C = Counter(Ss)
m = max(C.values())

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

for a in ans:
    print(a)

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

def solve():
    N = int(input())
    Sss = [input().rstrip() for _ in range(N)]

    cnt = Counter(Sss)
    

    maxNum = max(cnt.values())
    

    anss = []
    for key, value in cnt.items():
        if value == maxNum:
            anss.append(key)
    

    anss.sort()

    print('\n'.join(anss))


solve()

Solution (Python):
from collections import defaultdict


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

maxim = max(dict.values())

candidates = []

for key, count in dict.items():
    if count == maxim:
        candidates.append(key)

candidates.sort()

for ans in candidates:
    print(ans)

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

D = []

S.sort()

re = S[0]
c = 1
for i in range(1, N):
  if re == S[i]:
    c += 1
  else:
    D.append([c, re])
    c = 1
    re = S[i]
D.append([c, re])

D.sort(reverse = True)
mi = D[0][0]
L = []
for i in range(len(D)):
  if D[i][0] == mi:
    L.append(D[i][1])
  else:
    break

L.sort()
for i in L:
  print(i)

Solution (Python):
import sys
from collections import defaultdict
range = xrange
input = raw_input

n = int(input())

count = defaultdict(int)
S = sys.stdin.read().split()
for c in S:
    count[c] += 1

best = -1
for s in count:
    best = max(best, count[s])

out = []
for s in count:
    if count[s] == best:
        out.append(s)
out.sort()
print '\n'.join(out)

Solution (Python):
from collections import defaultdict

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

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

maxn = max(D.values())

res = []

for s in S:
    if D[s] == maxn:
        res.append(s)

res = sorted(set(res))

for r in res:
    print(r)

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

M = max(D.values())
for S in sorted(list(D)):
    if D[S]==M: print(S)

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

cnt = Counter(a)
max_s = max(cnt.values())
ans = []
for s, i in cnt.items():
    if i == max_s:
        ans.append(s)

ans.sort()
print("\n".join(ans))

Solution (Python):
from collections import Counter
n = int(input())
S = [input() for _ in range(n)]
C = Counter(S)
l = C.most_common()[0][1]
L = []
for i, j in C.items():
  if j == l:
    L.append(i)
L.sort()
print(*L, sep="\n")

Solution (Python):
from collections import Counter
N = int(input())
Ss = [input() for _ in range(N)]
ct = Counter(Ss)
M = ct.most_common(1)[0][1]
for s in sorted(ct.keys()):
    if ct[s] == M:
        print(s)

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

Solution (Python):
def main():
    from collections import Counter

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

    ctr = Counter(s)

    _, most_cnt = ctr.most_common()[0]

    ret = []
    for key, cnt in ctr.most_common():
        if cnt != most_cnt:
            break
        ret.append(key)

    ret.sort()

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


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict
N = int(input())
d = defaultdict(int)
for _ in range(N):
    s = input()
    d[s]+=1
m = max(d.values())
ans = []
for k, v in d.items():
    if v == m:
        ans.append(k)
ans.sort()
print(*ans, sep = '\n')

Solution (Python):
from sys import stdin, stdout

n = input()
f = dict()
inp = stdin.readlines()
for line in inp:
    s = line.strip()
    try: f[s] += 1
    except: f[s] = 1

mx = 0
for key in f:
    mx = max(mx, f[key])

l = []
for key in f:
    if f[key] == mx:
        l.append(key)
l.sort()

stdout.write("\n".join(l))

Solution (Python):



import sys
readline = sys.stdin.readline
read = sys.stdin.read





n = int(input())

from collections import Counter

d = Counter(read().split())

m = max(d.values())

a = sorted(d.items())

for s,si in a:
    if si == m:
        print(s)

Solution (Python):

lis = []
dic = {}

N = int(input())
maxi = 0

for i in range(N):

    S = input()

    if S not in dic:
        lis.append(S)
        dic[S] = 1
    else:
        dic[S] += 1

    maxi = max(maxi , dic[S])

lis.sort()

ans = []

for i in lis:
    if dic[i] == maxi:
        ans.append(i)


print ("\n".join(ans))

Solution (Python):
N = int(input())
D = {}
ma = 0
for _ in range(N):
    s = input()
    if s not in D: D[s] = 0
    D[s] += 1
    ma = max(ma, D[s])

ANS = []
for d in D:
    if D[d] == ma:
        ANS.append(d)
for ans in sorted(ANS):
    print(ans)

Solution (Python):
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
d = dict()
for _ in range(n):
    x = input()
    if x not in d: d[x] = 0
    d[x] += 1
f = max(d.values())
l = [x for x in d if d[x] == f]
l.sort()
print(*l, sep='\n')

Solution (Python):
from collections import Counter

n=int(input())
s=[input() for i in range(n)]
c=Counter(s)
c_v=sorted(c.values(),reverse=True)

m=c_v[0]

ans=[]
for k,v in c.items():
 if v==m:
  ans.append(k)
ans.sort()
for i in ans:
 print(i)

Solution (Python):
import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()


def summarize_list(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res


def main():
  n=I()
  l=[S() for _ in range(n)]

  l=summarize_list(l)

  l=sorted(l,key=lambda x:x[0])
  l=sorted(l,key=lambda x:x[1],reverse=True)

  a=l[0][1]
  print(l[0][0])

  for x,y in l[1:]:
    if y!=a:
      break
    else:
      print(x)

main()

Solution (Python):
N=int(input())
from collections import Counter
c=Counter([input() for i in range(N)]).most_common()
r=[]
V=c[0][1]
for k,v in c:
    if v!=V:
        break
    r.append(k)
print(*sorted(r),sep="\n")

Solution (Python):
def examA():
    N = LI()
    N.sort()
    if N[0]==N[1] and N[0]!=N[2]:
        print("Yes")
    elif N[1]==N[2] and N[0]!=N[2]:
        print("Yes")
    else:
        print("No")
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a%2==0:
            if a%3!=0 and a%5!=0:
                print("DENIED")
                return
    print("APPROVED")
    return

def examC():
    N = I()
    S = [SI()for _ in range(N)]
    d = defaultdict(int)
    for s in S:
        d[s] += 1
    t = max(d.values())
    ans = []
    for s in S:
        if d[s]==t:
            ans.append(s)
            d[s] = 0
    ans.sort()
    for v in ans:
        print(v)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Solution (Python):
import sys
input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15


def main():
    n = getN()
    
    
    d = defaultdict(int)
    for i in range(n):
        s = input().strip()
        d[s] += 1
    
    mx = max(d.values())
    ans = [k for (k, v) in d.items() if v == mx]

    ans.sort()
    for an in ans:
        print(str(an)[2:-1])

if __name__ == '__main__':
    main()

"""
9999
3

2916
"""

Solution (Python):
n = int(input())
d = {}

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

ans_buf = []
max_c =0
for key in d.keys():
    if d[key] > max_c:
        ans_buf = []
        ans_buf.append(key)
        max_c = d[key]
    elif d[key] == max_c:
        ans_buf.append(key)
    else:
        continue

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

Solution (Python):
from collections import defaultdict
N = int(input())
d = defaultdict(lambda:0)
for i in range(N):
    S = input()
    d[S] += 1
M = 0
for S in d:
    M = max(M,d[S])
ans = []
for S in d:
    if d[S]==M:
        ans.append(S)
ans.sort()
for s in ans:
    print(s)

Solution (Python):
d = {}
n = int(input())
c = 0
for _ in range(n):
    s = input()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
    c = max(c, d[s])
lis = sorted(d.items(), key=lambda x: x[1], reverse=True)
ans = []
for a in lis:
    if a[1] == c:
        ans.append(a[0])
ans = sorted(ans)
for v in ans:
    print(v)

Solution (Python):
N = input()
S = [raw_input() for _ in range(N)]

M = {}
for s in S:
  if s not in M:
    M[s] = 0
  M[s] += 1
m = max(M.values())
for a in sorted(k for k in M if M[k]==m):
  print a