Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
tmp = []
for _ in range(N):
    tmp.append(input())
tmp.sort()

w = []
c = []

# print(tmp)
m = 0
for i in tmp:
    if i not in w:
        w.append(i)
        c.append(tmp.count(i))
        if m < tmp.count(i):
            m = tmp.count(i)

# print(w)
# print(c)

for i in c:
    if m == i:
        print(w[c.index(i)])
        c[c.index(i)] = -1

Fixed submission:
N = int(input())

ans = {}
m = 1
for _ in range(N):
    w = input()
    c = ans.get(w)
    # print(c)
    # print(type(c))
    if c == None:
        ans[w] = 1
    else:
        ans[w] = c + 1
        if c + 1 > m:
            m = c + 1
# print(ans)

tmp = []
for a in ans:
    if ans[a] == m:
        tmp.append(a)

tmp.sort()
for t in tmp:
    print(t)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
tmp = []
for _ in range(N):
    tmp.append(input())
tmp.sort()
# print(tmp)

n = []
for t in tmp:
    n.append(tmp.count(t))

# print(n)
m = max(n)
b = ""
for i in n:
    # print(i)
    if i == m:
        if b != tmp[n.index(i)]:
            print(tmp[n.index(i)])
            b = tmp[n.index(i)]
        n[n.index(i)] = -1

Fixed submission:
N = int(input())

ans = {}
m = 1
for _ in range(N):
    w = input()
    c = ans.get(w)
    # print(c)
    # print(type(c))
    if c == None:
        ans[w] = 1
    else:
        ans[w] = c + 1
        if c + 1 > m:
            m = c + 1
# print(ans)

tmp = []
for a in ans:
    if ans[a] == m:
        tmp.append(a)

tmp.sort()
for t in tmp:
    print(t)

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

ans = []
n = 1
for _ in range(N):
    tmp = input()


    for a in ans:
        if a[0] == tmp:
            a[1] = a[1] + 1
            if a[1] > n:
                n = a[1]
            continue
    
    ans.append([tmp, 1])
last = []
for a in ans:
    if a[1] == n:
        last.append(a[0])
last.sort()
# print()
for l in last:
    print(l)

Fixed submission:
N = int(input())

ans = {}
m = 1
for _ in range(N):
    w = input()
    c = ans.get(w)
    # print(c)
    # print(type(c))
    if c == None:
        ans[w] = 1
    else:
        ans[w] = c + 1
        if c + 1 > m:
            m = c + 1
# print(ans)

tmp = []
for a in ans:
    if ans[a] == m:
        tmp.append(a)

tmp.sort()
for t in tmp:
    print(t)

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

ans = []

for _ in range(N):
    tmp = input()

    # if len(ans) == 0:
    #     ans.append([tmp, 1])
    #     continue

    for a in ans:
        if a[0] == tmp:
            a[1] = a[1] + 1
            continue
    
    ans.append([tmp, 1])

n = 0
for a in ans:
    if a[1] > n:
        n = a[1]

last = []
for a in ans:
    if a[1] == n:
        last.append(a[0])
last.sort()
for l in last:
    print(l)

Fixed submission:
N = int(input())

ans = {}
m = 1
for _ in range(N):
    w = input()
    c = ans.get(w)
    # print(c)
    # print(type(c))
    if c == None:
        ans[w] = 1
    else:
        ans[w] = c + 1
        if c + 1 > m:
            m = c + 1
# print(ans)

tmp = []
for a in ans:
    if ans[a] == m:
        tmp.append(a)

tmp.sort()
for t in tmp:
    print(t)