Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[input() for i in range(N)]
NA=[A.count(A[i]) for i in range(N)]
MAX=max(NA)
NIN=[i for i, v in enumerate(NA) if v == MAX]
LN=len(NIN)
NM=[A[NIN[i]] for i in range (LN)]
NM=sorted(list(set(NM)))
for i in NM:
    print(i)

Fixed submission:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

Ans = []

Ans.append(D[0][0])

for i in range(len(D)-1):
    if D[i][1] == D[i+1][1]:
        Ans.append(D[i+1][0])
    else:
        break

Ans = sorted(Ans)

for i in Ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N=int(input())
    A=[input() for i in range(N)]
    NA=[A.count(A[i]) for i in range(N)]
    NIN=[i for i, v in enumerate(NA) if v == max(NA)]
    NM=sorted(list(set([A[NIN[i]] for i in range (len(NIN))])))
    for i in range (len(NM)):
        print(NM[i])
if __name__ == '__main__':
    main()

Fixed submission:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

Ans = []

Ans.append(D[0][0])

for i in range(len(D)-1):
    if D[i][1] == D[i+1][1]:
        Ans.append(D[i+1][0])
    else:
        break

Ans = sorted(Ans)

for i in Ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N=int(input())
    A=[input() for i in range(N)]
    NA=[A.count(A[i]) for i in range(N)]
    NIN=[i for i, v in enumerate(NA) if v == max(NA)]
    NM=[A[NIN[i]] for i in range (len(NIN))]
    NM=sorted(list(set(NM)))
    for i in range (len(NM)):
        print(NM[i])
if __name__ == '__main__':
    main()

Fixed submission:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

Ans = []

Ans.append(D[0][0])

for i in range(len(D)-1):
    if D[i][1] == D[i+1][1]:
        Ans.append(D[i+1][0])
    else:
        break

Ans = sorted(Ans)

for i in Ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[input() for i in range(N)]
NA=[A.count(A[i]) for i in range(N)]
NIN=[i for i, v in enumerate(NA) if v == max(NA)]
NM=[A[NIN[i]] for i in range (len(NIN))]
NM=sorted(list(set(NM)))
for i in range (len(NM)):
    print(NM[i])

Fixed submission:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

Ans = []

Ans.append(D[0][0])

for i in range(len(D)-1):
    if D[i][1] == D[i+1][1]:
        Ans.append(D[i+1][0])
    else:
        break

Ans = sorted(Ans)

for i in Ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[input() for i in range(N)]
NA=[A.count(A[i]) for i in range(N)]
NIN=[i for i, v in enumerate(NA) if v == max(NA)]
NM=[A[NIN[i]] for i in range (len(NIN))]
NM=sorted(list(set(NM)))
for i in range (len(NM)):
    print(NM[i])

Fixed submission:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

Ans = []

Ans.append(D[0][0])

for i in range(len(D)-1):
    if D[i][1] == D[i+1][1]:
        Ans.append(D[i+1][0])
    else:
        break

Ans = sorted(Ans)

for i in Ans:
    print(i)