Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s={}
for i in range(0,n):
  cs=input()
  if cs in s.keys():
    s[cs]+=1
  else:
    s[cs]=1

maxks=[kv[0] for kv in s.items() if kv[1]==max(s.values())]
maxks.sort()
print('\n'.join(maxks))



Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

from collections import Counter

n = int(input())
s=[input() for i in range(n)]
l=Counter(s)
m=0
for i in l.values():
  m=max(m,i)
ans=[]
for k,v in l.items():
  if v==m:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):

#a = int(input())
#b, c = map(int, input().split())
#l = list(map(int, input().split()))


n = int(input())
s=['']*n
st=[]
for i in range(0,n):
  s[i]=input()
  if not s[i] in st:
    st.append(s[i])

maxc=0
anss=[]
for i in range(0,len(st)):
  cc=s.count(st[i])
  if cc>maxc:
    maxc=cc
    anss=[st[i]]
  elif cc==maxc:
    anss.append(st[i])

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


Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

from collections import Counter

n = int(input())
s=[input() for i in range(n)]
l=Counter(s)
m=0
for i in l.values():
  m=max(m,i)
ans=[]
for k,v in l.items():
  if v==m:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# スペース区切りの整数リストの入力
#l = list(map(int, input().split()))
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))
#Print Yes or No
#print('YNeos'[1::2])
#print('YNeos'[0::2])
#print('NYoe s'[1::2])
#print('NYoe s'[0::2])
#print('YNEOS'[0::2])
#print('NYOE S'[1::2])


import re
import numpy as np
import math

#a = int(input())
#b, c = map(int, input().split())
#l = list(map(int, input().split()))


n = int(input())
s=[]
c=[]
for i in range(0,n):
  ns=input()
  if ns in s:
    c[s.index(ns)] += 1
  else:
    #new
    s.append(ns)
    c.append(1)

cmax = max(c)
c = np.array(c)
anss=np.array(s)[c==cmax]

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


Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

from collections import Counter

n = int(input())
s=[input() for i in range(n)]
l=Counter(s)
m=0
for i in l.values():
  m=max(m,i)
ans=[]
for k,v in l.items():
  if v==m:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
import re
import numpy as np
import math

#a = int(input())
#b, c = map(int, input().split())
#l = list(map(int, input().split()))


n = int(input())
s=[]
c=[]
for i in range(0,n):
  ns=input()
  if ns in s:
    c[s.index(ns)] += 1
  else:
    #new
    s.append(ns)
    c.append(1)

cmax=max(c)
anss=[]
for i in range(0,len(c)):
  if c[i]==cmax:
    anss.append(s[i])

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


Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

from collections import Counter

n = int(input())
s=[input() for i in range(n)]
l=Counter(s)
m=0
for i in l.values():
  m=max(m,i)
ans=[]
for k,v in l.items():
  if v==m:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')