Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [0] * n
li = []
ans = []
for i in range(n):
    s[i] = input()
    if s[i] in ans:
        li[ans.index(s[i])][1] += 1
    else:
        li.append([s[i], 1])
        ans.append(s[i])
              
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = li[0][1]
for j in range(len(ans)):
    if a == li[j][1]:
        print(li[j][0])
    else:
        break

Fixed submission:
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

max_dic = max(dic.values())
ans = [i for i, j in dic.items() if j == max_dic]
ans.sort()

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [0] * n
li = []
ans = []
for i in range(n):
    s[i] = input()
    if s[i] in ans:
        li[ans.index(s[i])][1] += 1
    else:
        li.append([s[i], 1])
        ans.append(s[i])
              
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = li[0][1]
for j in range(len(ans)):
    if a == li[j][1]:
        print(li[j][0])
    else:
        break

Fixed submission:
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

max_dic = max(dic.values())
ans = [i for i, j in dic.items() if j == max_dic]
ans.sort()

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [0] * n
li = []
ans = []
for i in range(n):
    s[i] = input()
    if s[i] in ans:
        li[ans.index(s[i])][1] += 1
    else:
        li.append([s[i], 1])
        ans.append(s[i])
              
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = li[0][1]
for j in range(len(li)):
    if a == li[j][1]:
        print(li[j][0])
    else:
        break

Fixed submission:
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

max_dic = max(dic.values())
ans = [i for i, j in dic.items() if j == max_dic]
ans.sort()

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [0] * n
li = []
ans = []
for i in range(n):
    s[i] = input()
    if s[i] in ans:
        li[ans.index(s[i])][1] += 1
    else:
        li.append([s[i], 1])
        ans.append(s[i])
              
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = li[0][1]
for i in range(len(li)):
    if a == li[i][1]:
        print(li[i][0])
    else:
        break

Fixed submission:
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

max_dic = max(dic.values())
ans = [i for i, j in dic.items() if j == max_dic]
ans.sort()

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [0] * n
for i in range(n):
    s[i] = input()

li = []
ans = []
for i in range(n):
    if s[i] in ans:
        li[ans.index(s[i])][1] += 1
    else:
        li.append([s[i], 1])
        ans.append(s[i])
            
                
li.sort(key = lambda x: x[0])
li.sort(key = lambda x: x[1] , reverse = True)

a = li[0][1]
for i in range(len(li)):
    if a == li[i][1]:
        print(li[i][0])
    else:
        break

Fixed submission:
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

max_dic = max(dic.values())
ans = [i for i, j in dic.items() if j == max_dic]
ans.sort()

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [0] * n
for i in range(n):
    s[i] = input()

li = []
ans = [0] * n
for i in range(n):
    if s[i] in li:
        ans[li.index(s[i])] += 1
    else:
        li.append(s[i])
        ans[li.index(s[i])] += 1

mx = max(ans)
m = [i for i, j in enumerate(ans) if j == mx]

a = []
for k in range(len(m)):
    a.append(li[m[k]])

a.sort()
for n in range(len(a)):
    print(a[n])

Fixed submission:
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

max_dic = max(dic.values())
ans = [i for i, j in dic.items() if j == max_dic]
ans.sort()

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