Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
dic = {}

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


x = [ i[0] for i in dic.items() if i[1] == max(dic.values())]

x.sort()

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

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(N)]
dic = {}

for i in range (N):
  if S[i] in dic:
    dic[S[i]] += 1
  else:
    dic[S[i]] = 1


x = [ i[0] for i in dic.items() if i[1] == max(dic.values())]
x.sort()
for i in range(len(x)):
  print(x[i])

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)

list1 =sorted( [kv[0] for kv in c.items() if kv[1] == max(c.values())])
for i in range(len(list1)):
  print(list1[i])

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
a = list(c.items())
b = list(c.values())

list1 =sorted( [kv[0] for kv in a if kv[1] == max(b)])
for i in range(len(list1)):
  print(list1[i])

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = sorted([input() for i in range(N)])
list1 = []
count = 1

for s in S:
  
  c = S.count(s)
  if c == count:
    list1.append(s)
  elif c > count:
    list1 = [s]
    count = c
  #while s in S:
   #   S.remove(s)
  
cc = collections.Counter(list1)
for i in cc:  
  print(i)

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
dic = {}

for i in range(N):
  key = input()
  if key in dic:
    dic[key] += 1
  else:
    dic[key] = 1
ans = sorted([kv[0] for kv in dic.items() if kv[1] == max(dic.values())])

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

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
a = [kv for kv in c.items() if kv[1] == max(c.values())]
ans = sorted(a, key= lambda x:x[0])
for i in range(len(ans)):
  print(ans[i][0])

Fixed submission:
N = int(input())
dic = {}

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  print(j)