Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sl = list(input() for _ in range(n))

sl_s = sorted(list(set(sl)))

# if len(sl_s) == 1:
#     print(sl[0])
# else:
#     ans = []
#     count = 1
#     for s in sl_s:
#         if sl.count(s) == count and ans.count(s) == 0:
#             ans.append(s)
#         elif sl.count(s) > count and ans.count(s) == 0:
#             ans.clear()
#             ans.append(s)
#             count = sl.count(s)
#     print('\n'.join(ans))


dict = {}
for s in sl:
    if s in dict:
        dict[s] += 1
    else:
        dict[s] = 1

ans_ = [k for k, v in dict.items() if v == max(dict.values())]
ans = '\n'.join(sorted(ans_))
print(ans)


Fixed submission:
from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))

cnt = Counter(sl)
# print('cnt:', cnt)
maxNum = max(cnt.values())
# print('maxNum:', maxNum)

ans = []
for k, v in cnt.items():
    if v == maxNum:
        ans.append(k)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sl = list(input() for _ in range(n))

sl_s = sorted(list(set(sl)))

if len(sl_s) == 1:
    print(sl[0])
else:
    ans = []
    count = 1
    for s in sl_s:
        if sl.count(s) == count and ans.count(s) == 0:
            ans.append(s)
        elif sl.count(s) > count and ans.count(s) == 0:
            ans.clear()
            ans.append(s)
            count = sl.count(s)
    print('\n'.join(ans))

Fixed submission:
from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))

cnt = Counter(sl)
# print('cnt:', cnt)
maxNum = max(cnt.values())
# print('maxNum:', maxNum)

ans = []
for k, v in cnt.items():
    if v == maxNum:
        ans.append(k)

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

Buggy python submission (verdict: Runtime Error):
sl_s = sorted(list(set(sl)))

if len(sl_s) == 1:
    print(sl[0])
else:
    ans = []
    count = 1
    for s in sl_s:
        if sl.count(s) == count and ans.count(s) == 0:
            ans.append(s)
        elif sl.count(s) > count and ans.count(s) == 0:
            ans.clear()
            ans.append(s)
            count = sl.count(s)
    print('\n'.join(ans))

Fixed submission:
from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))

cnt = Counter(sl)
# print('cnt:', cnt)
maxNum = max(cnt.values())
# print('maxNum:', maxNum)

ans = []
for k, v in cnt.items():
    if v == maxNum:
        ans.append(k)

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sl = list(input() for _ in range(n))


dict = {}
for s in sl:
    if s in dict:
        dict[s] += 1
    else:
        dict[s] = 1

# max_num = max(dict.values())
#
# dict = sorted(dict.items())
# for k, v in dict.items():
#     if v == max_num:
#         print(k)


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

ans = [k for k, v in dict.items() if v == max(dict.values())]
ans = sorted(ans)
ans_ = '\n'.join(ans)
print(ans_)


Fixed submission:
from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))

cnt = Counter(sl)
# print('cnt:', cnt)
maxNum = max(cnt.values())
# print('maxNum:', maxNum)

ans = []
for k, v in cnt.items():
    if v == maxNum:
        ans.append(k)

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