Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lisa=[]
ans=1
add=[]
coua=0
for i in range(n):
    a=input()
    lisa.append(a)
    coua=lisa.count(a)
    if ans<coua:
        add=[]
        ans=coua
        add.append(a)
    elif ans==coua:
        add.append(a)
add=sorted(set(add))
for i in range(len(add)):
    print(add[i])

Fixed submission:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lisa=[]
ans=1
add=[]
coua=0
for i in range(n):
    a=input()
    lisa.append(a)
    coua=lisa.count(a)
    if ans<coua:
        add=[]
    if ans<=coua:
        ans=coua
        add.append(a)
add=sorted(set(add))
for i in range(len(add)):
    print(add[i])

Fixed submission:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lisa=[]
ans=1
add=[]
for i in range(n):
    a=input()
    lisa.append(a)
    if ans<lisa.count(a):
        add=[]
    if ans<=lisa.count(a):
        ans=lisa.count(a)
        add.append(a)
add=sorted(list(set(add)))
for i in range(len(add)):
    print(add[i])

Fixed submission:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lisa=[]
ans=0
for i in range(n):
    a=input()
    lisa.append(a)
    if ans<lisa.count(a):
        ans=lisa.count(a)
add=[]
for i in range(n):
    if lisa.count(lisa[i])==ans:
        add.append(lisa[i])
add=sorted(list(set(add)))
for i in range(len(add)):
    print(add[i])

Fixed submission:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
lisa=[]
for i in range(n):
    a=input()
    lisa.append(a)
ans=0
add=[]
for i in range(n):
    if ans<lisa.count(lisa[i]):
        ans=lisa.count(lisa[i])
for i in range(n):
    if lisa.count(lisa[i])==ans:
        add.append(lisa[i])
add=sorted(list(set(add)))
for i in range(len(add)):
    print(add[i])

Fixed submission:
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]