peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
a = list(map(int,input().split()))
flag = 0

for i in a:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      flag = 1
    else:
      flag = 0
      break
  
if flag == 1:
  print('APPROVED')
else:
  print('DENIED')
N = input()
A = map(int, input().split())

for x in A:
    if x%2==0&(x%3!=0 and x%5!=0):
        print('DENIED')
        exit()
print('APPROVED')
N = int(input())
aa = map(int, input().split())

f = False
for a in aa:
  if a % 2 == 0:
    if (a % 3 != 0) or (a % 5 != 0):
      print('DENIED')
      f = True
      break
if not f:
  print('APPROVED')
N=int(input())
A=list(map(int,input().split()))
even=[]
for a in A:
    if a%2==0:
        even.append(a)
    
if len(even)==0:
    print("APPROVED")
    exit()
    
ans=False
    
for e in even:
    if e%3==0 or e%5==0:
        ans=True
    else:
        break

print("APPROVED" if ans else "DENIED")
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
  if i%2==0:
    if i%3!=0 and i%5!=0:
      print('DENIED')
      exit()
print('APPROVED')
n = int(input())
a = list(map(int,input().split()))
ans = 0

for i in a:
  if i%2 ==0 and (i%3 !=0 or i%5 != 0):
    ans += 1
  else:
    pass
  
if ans >0:
  print("DENIED")
else:
  print("APPROVED")
N=int(input())
A=list(map(int,input().split()))

flag=0

for i in range(N):
  if A[i]%2==0:
    if A[i]%3>0 or A[i]%5>0:
      flag=1
      break
if flag==1:
  print("DENIED")
else:
  print("APPROVED")
N = int(input())
*A, = map(int, input().split())
B = []
for i in A:
  if i % 2 == 0:
    B.append(i)
C = 0
for l in B:
  if l % 3 == 1 or l % 5 == 0:
    C += C + 1
  else:
    C += C + 2
if C/N ==1:
  print('APPROVED')
else:
  print('DENIED')
N = int(input())
A = list(map(int, input().split()))
 
j = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] %3 == 0 or A[i] % 5 ==0:
            pass
        else:
            j = False
            exit()
            
if j == True:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = input().split()
for i in range(N):
    if int(A[i])%2==0:
        if int(A[i])%15!=0:
            print("DENIED")
            break
    print("APPROVED")
def solve():
    X = list(map(int, input().split()))
    for x in X:
        if x%2 != 0:
            continue
        elif x%3 != 0 and x%5 != 0:
            return "DENIED"
    return "APPROVED"

print(solve())
import sys
N = int(input())
A = [int(i) for i in input().split()]
for i in A:
  if not i%3 == 0 or not i % 5 == 0:
    print("DENIED")
    sys.exit()
  else :
    continue
print("APPROVED")
def main():
    N = int(input())
    A = list(map(int,input().split()))
    i = 0
    while i < N:
        if A[i] % 2 == 0:
            if (A[i] % 3) != 0 and (A[i] % 5) != 0:
                break
                return("DENIED")
        i += 1
    return("APPROVED")
print(main())
N = input()
A = list(map(str, input().split()))
B=[]
C=[]
l=[]
m=[]
i=0
for a in range(int(N)):
    if int(A[a])%2==0:
       B.append(A[a])
       i=i+1
print(B)
for a in range(int(i)):
    if not int(B[a])%3==0 or int(B[a])%5==0:
       C=1
    else:
       C=0
print(C)
if C==1:
   print("DENIED")
else:
   print("APPROVED")
a = int(input())
 
b=list(map(int, input().split())) 
x = 0
c = 0

for t in b:
  if (t%2==0):
    c += 1;
if (a==0) :
	print('DENIED')
elif (b.count(0) > 0):
	print('DENIED')
else:
  for i in b:
      if (i % a == 0) and (i % 2 == 0):
          x += 1
if x == c:
  print('APPROVED')
else :
  print('DENIED')
n = int(input())
a = list(map(int, input().split()))
for i in a:
  if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
    print('DENIED')
else: print('APPROVED')
n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            count += 1
        else:
            count -=110
print("APPROVED" if count >=1  else "DENIED")
N = int(input())
A = list(map(int, input().split()))
count = 0
check = 0
for i in A:
    if i%2 == 0:
        count += 1
        if (i%3 == 0 and i%5 != 0) or (i%3 != 0 and i%5 == 0):
            check += 1
if count == check:
	print('APROVED')
else:
	print('DENIED')
n = int(input())
a = list(map(int, input().split()))

def dfs():
    for i in range(n):
        if a[i]%2 ==0:
            if a[i]%3 == 0 or a[i]%5==0:
                return True
            else:
                return False
                break

if dfs():
    print('APPROVED')
else:
    print('DENIED')
N=int(input())
s=input().strip().split()
for j in range (N):
  n=int(s[j])
  z=int('0')
  if (n-z) %2 ==0:
    if (n-z) % 3 != 0 and (n-z) % 5 != 0:
      print("DENIED")
      break
  print("APPROVED")
  break
a = input()
b = input().split()
c = "APPROVED"
for i in b:
    if int(i)%6 != 0 and int(i)%10 != 0:
        c = "DENIED"
        break

print(c)
n =int(input())

A = [0 for x in input().split() 
     if int(x) % 2 == 1 or int(x) % 6 == 0 or int(x) % 10 == 0 ]
if not A:
    print("DENIED")
else:
    print("APPROVED")
N = int(input())
nums = list(map(int, input().split(' ')))

flag = False

for i in range(N):
  if nums[i]%2 == 0 :
    if nums[i]%3 == 0:
      continue
    elif nums[i]%5 == 0:
      continue
    else:
      flag = True
      print('DENIED')
  else:
    continue

if flag == False:
  print('APPROVED')
N = int(input())
L = list(map(int, input().split()))

ans = "APPROVED"
for i in range(N):
  if L[i]%2 == 0:
    if L[i]%3 == 0 and L[i]%5 == 0:
      pass
    else:
      ans = "DENIED"
      break
      
print(ans)
n = input()
data = [int(str) for str in input().split() if int(str)%2 ==0]
for i in data:
  if i%3 != 0 or i%5 != 0:
    print("DENIED")
    break
  else:
    print("APPROVED")
    break
n = int(input())
A = list(map(int, input().split()))

for i in range(n):
    if A[i]%2 == 0 and A[i]%3 == 0:
        print('APPROVED')
    elif A[i]%2 == 0 and A[i]%5 == 0:
        print('APPROVED')
    else:
        print('DENIED')
# B Papers,Please
n = int(input())
a = list(map(int, input().split()))
ans = 0
ant = 0
for i in range(n):
    if a[i] % 2 == 0:
        ant += 1
        if a[i] % 3 == 0:
            ans += 1
        elif a[i] % 5 == 0:
            ans += 1

if ant == ans:
    if ant > 0:
        print("APPROVED")
    else:
        print("DENIED")
else:
    print("DENIED")
N = int(input())
a = list(map(int,input().split()))
flag = False
for i in range(N):
  if a[i]%2 ==0:
    if a[i]%3==0 or a[i]%5 ==0:
      flag = True
    else:
      falg = False
      break
      
      
if flag == True:
  print('APPROVED')
else:
  print('DENIED')
import sys

N = list(map(int, input().split()))
print(N)
A = list(map(int, input().split()))
print(A)

for x in A:
    if (x % 2 == 0) and ((x % 3 != 0) or (x % 5 != 0)):
        print('DENIED')
        sys.exit()

print ('APPROVED')
d = {}
n = int(input())

for i in range(n):
  x = input()
  if x in d:
    d[x] += 1
  else:
    d[x] = 1

mx = 0
ans = []

for itm in d.items():
  if itm[1] == mx:
    ans.append(itm[0])
  elif itm[1] > mx:
    ans = [itm[0]]
    mx = itm[1]
  else:
    continue

ans.sort()

for x in ans:
  print(x)
import sys
readline = sys.stdin.readline
from collections import Counter
N = int(readline())
C = Counter()

for _ in range(N):
    S = readline().strip()
    C[S] += 1

ma = max(C.values())
K = [k for k, v in C.items() if v == ma]
K.sort()
print('\n'.join(K))
N = int(input())
count = {}
max_count = 0
for _ in range(N):
  s = input()
  if s not in count:
    count[s] = 0
  count[s] += 1
  max_count = max(max_count, count[s])

longest = []
for s, c in count.items():
  if c == max_count:
    longest.append(s)

longest.sort()
for s in longest:
  print(s)
import collections
n=int(input())
s=[]
ans=[]
for i in range(n):
    si=input()
    s.append(si)
s_new=collections.Counter(s)
s_most=s_new.most_common()
buf=s_most[0][1]
cnt=0
for i in range(len(s_new)):
    if s_most[i][1]==buf:
        ans.append(s_most[i][0])
        cnt+=1
    elif s_most[i][1]<buf:
        break
ans_sorted=sorted(ans)
for i in range(cnt):
    print(ans_sorted[i])
import collections


N = int(input())
S = [None] * N
for i in range(N):
    S[i] = input()

count = collections.Counter(S)
max_n = max(count.values())
# print(max_n)

keys = [k for k, v in count.items() if v == max_n]
keys.sort()

for s in keys:
    print(s)
from collections import Counter
N = int(input())
s = [input() for _ in range(N)]
#a = list(map(int, input().split()))

c = Counter(s)


imax = len

values, counts = zip(*c.most_common())

for i in range(len(counts)):
    if counts[0]==counts[i]:
        imax = i

value = [values[i] for i in range(imax+1)]
value.sort()
print(*value, sep='\n')
from sys import stdin
input = stdin.readline
N = int(input())
S = {}
for n in range(N):
    s = input()
    if S.get(s) == None:
        S[s] = 1
    else:
        S[s] += 1
m = max(S.values())
A = [k for k,v in S.items() if v == m]
A = sorted(A)
for a in A:
    print(a.rstrip('\n'))
N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(i)
	elif max < v:
		results = [i]
		max = v

results.sort()
for i in results:
	print(i)
n = int(input())
s = [input() for _ in range(n)]
d = dict()
for st in s:
    if st not in d:
        d[st] = 1
    else:
        d[st] += 1
m = max(d.values())
ans = set()
for k, v in d.items():
    if v == m:
        ans.add(k)
ans = sorted(ans)
for st in ans:
    print(st)
n = int(input())
s = []
for _ in range(n):
    s.append(input())

import collections
c = collections.Counter(s)
ans=[]
first=c.most_common()[0][1]
for tup in c.most_common():
    if tup[1] != first:
        break
    ans.append(tup[0])
ans.sort()

for i in ans:
    print(i)
from collections import defaultdict
from collections import OrderedDict
n = int(input())
answer = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        answer[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)
import numpy as np
N = int(input())
S = np.array([input() for _ in range(N)], dtype=str)
keys, values = np.unique(S, return_counts=True)
cnt = []
for k, v in zip(keys, values):
    cnt.append([k, v])
cnt.sort(reverse=True, key=lambda x: x[1])
a = cnt[0][1]
ans = []
for k, v in cnt:
    if v < a:
        break
    ans.append(k)
ans.sort()
for a in ans:
    print(a)
N=int(input())
D={}
for i in range(N):
    s=input()
    if s in D:
        D[s]+=1
    else:
        D[s]=1
    

m=max(D.values())
d=list(D.values())
k=list(D.keys())
ans=[]
for i in range(len(D)):
    if m==d[i]:
        ans.append(k[i])

ans=sorted(ans)
for a in ans:
    print(a)
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
C = c.most_common()
a = C[0][1]
ans = []
for i in range(len(c)):
  if C[i][1] == a:
    ans.append(C[i][0])

ans.sort()
print(*ans,sep="\n")
import collections
n=int(input())
lst=[]
for i in range(n):
    lst.append(input())
cnt=collections.Counter(lst)
ma=0
for val in cnt.values():
    val=int(val)
    if(val>ma):
        ma=val
li=[]
for key,val in cnt.items():
    val=int(val)
    if(val==ma):
        li.append(key)
li.sort()
for i in li:
    print(i)
N = int(input())

s = [None for _ in range(N)]

for i in range(N):
  s[i] = input()

s.sort()

max_list = []
max_v = 1

count = 1
prev = s[0]


for i in range(1, N):
  # print(s[i], prev, count)
  if s[i] == prev:
    count += 1
  else:
    if max_v == count:
      max_list.append(prev)
    elif max_v < count:
      max_list = [prev]
      max_v = count
    count = 1
    prev = s[i]


if max_v == count:
  max_list.append(prev)
elif max_v < count:
  max_list = [prev]
  max_v = count

for k in max_list:
  print(k)
import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())

d = defaultdict(int)
for i in range(n):
    s = input().rstrip()
    d[s] += 1

ma = 0
for v in d.values():
    ma = max(ma, v)

a = sorted(d.items())
for k, v in a:
    if ma == v:
        print(k)
n = int(input())
d = {}
for i in range(n):
  s = input()
  d[s] = d.get(s, 0) + 1
m = max(d.values())
maxKeys = [x[0] for x in d.items() if x[1] == m]
so = sorted(maxKeys)
for e in so:
  print(e)
N = int(input())

d = {}
for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
    d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
  print(s)
def main():
    N = int(input())
    dict = {}

    for _ in range(N):
        word = input()
        if word in dict:
            dict[word] += 1
        else:
            dict[word] = 0

    m = max(dict.values())
    dict = sorted(dict.items(), key=lambda x: x[0])

    for d in dict:
        if d[1] == m:
            print(d[0])
    return 0


if __name__ == '__main__':
    main()
from collections import  Counter
n = int(input())
lst = []
for _ in range(n):
    lst.append(input())

C = Counter(lst)
x = max(C.values())
anslst = []
for k,v in C.items():
    if v == x:
        anslst.append(k)
anslst.sort()
for v in anslst:
    print(v)
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

cs = Counter(s).most_common()
m = cs[0][1]
ms = ([i for i in cs if i[1] == m])

for i in sorted(ms):
    print(i[0])
N = int(input())
S = []
for _ in range(N):
    S.append(input())
T = sorted(S)
T.append("uuuuuuuuuuuuu")
s = 0
t = 0
u = 0
d = []
for i in range(0,N):
    if T[i] != T[i+1]:
        s = i + 1 -t
        t = i + 1
        if s > u:
            d = [T[i]]
            u = s
        elif s == u:
            d.append(T[i])
            u = s
s_n = '\n'.join(d)
print(s_n)
import collections

n = int(input())

ss = []
for _ in range(n):
	ss.append(input())

c = collections.Counter(ss)

mc = c.most_common()
max_cnt = max([x[1] for x in mc])
ans = [x[0] for x in mc if x[1] == max_cnt]

ans.sort()
for x in ans:
	print(x)
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

for _ in range(n):
  i = input()
  s[i] += 1

s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = max(list(s.values()))

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)

ans.sort()

print('\n'.join(ans))
N = int(input())
list0 = {}
for i in range(N):
  x = input()
  if x in list0:
    list0[x] = list0[x] + 1
  else:
    list0[x] = 1
m = max(list0.values())
k_m = [key for key in list0 if list0[key] == m]
k_m.sort()
for i in range(len(k_m)):
  print(k_m[i])
N = int(input())
S = {}
c = 0
for _ in range(N):
	s = input()
	if s not in S:
		S[s] = 1
	else:
		S[s] += 1
	c = max(c, S[s])
ans = []
for k, v in S.items():
	if v == c:
		ans.append(k)
ans.sort()
for a in ans:
	print(a)
n = int(input())
a = {}
for i in range(n):
    s = input()
    if s in a:
        a[s] += 1
    else:
        a[s] = 1
a = sorted(a.items(), key=lambda x: x[1], reverse=True)
max_a = a[0][1]
w = []
for i in range(len(a)):
    if a[i][1] == max_a:
        w.append(a[i][0])
    else:
        break
w = sorted(w)
for i in range(len(w)):
    print(w[i])
n=int(input())
a_dict={}
for i in range(n):
    a=input()
    if a not in a_dict:
        a_dict[a]=0
    else:
        a_dict[a]+=1
# moji=[i for i,j in a_dict.items() if j==max(a_dict.values()) ]
moji=[]
j=max(a_dict.values())
for i,k in a_dict.items():
    if k==j:
        moji.append(i)
moji=sorted(moji)
for i in moji:
    print(i)
import numpy as np

N=int(input())

S=[]
count_S={}
for i in range(N):
    s=input()
    S.append(s)
    count_S[s]=0

for key in S:
    count_S[key]+=1

keys=np.array(list(count_S.keys()))
values=np.array(list(count_S.values()),dtype=np.int32)
out=np.where(values==np.max(values))
result=np.sort(keys[out])

for r in result:
    print(r)
N = int(input())
dic = {}
for _ in range(N):
    s = input()
    dic.setdefault(s, 0)
    dic[s] += 1
ans = list(dic.items())
ans.sort(key=lambda x: (-x[1], x[0]))
m = ans[0][1]
print("\n".join(i[0] for i in ans if i[1] == m))
import collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
        
ans.sort()
for a in ans:
    print(a)
n = int(input())
c = {}
m = 0
for i in range(n):
    s = input()
    if s in c:
        c[s] += 1
    else:
        c[s] = 1
    if m < c[s]:
        m = c[s]

ans = []

for i in c:
    if m == c[i]:
        ans.append(i)

ans = sorted(ans)

for i in ans:
    print(i)
import collections

n=int(input())
s=[]

for i in range(n):
    s.append(input())

d=collections.Counter(s).most_common()

ans=[]
past=d[0][1]

for i,m in d:
    if past==m:
        ans.append(i)
        past=m
    else:
        break

ans.sort()
for i in range(len(ans)):
    print(ans[i])
n = int(input())
dic = {}
lis = []
lis2 = []

for i in range(n):
  moji = input()
  if moji not in dic:
    dic[moji] = 0
  dic[moji] += 1
  
for i in sorted(dic.items(), key=lambda x:x[1]):
    lis.append(i)
  
lis.reverse()

for j in lis:
  if lis[0][1] == j[1]:
    lis2.append(j[0])
  else:
    break

lis2.sort()
for i in range(len(lis2)):
  print(lis2[i])
import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(ans)))
n=int(input())

dic={}
for i in range(n):
  s=input()
  if s not in dic:
    dic[s]=1
  else:
    dic[s]+=1


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

ma=dic[0][1]
for i,v in dic:
  if v!=ma:
    break
  else:
    print(i)
n =int(input())

s = []

for _ in range(n):
    s.append(input())

dictionary = {}

for i in s:
    if i in dictionary:
        dictionary[i] += 1
    else:
        dictionary[i] = 0

max_val = max(dictionary.values())
keys_of_max_val = []

for key in dictionary:
    if dictionary[key] == max_val:
        keys_of_max_val.append(key)

keys_of_max_val.sort()

for ans in keys_of_max_val:
    print(ans)
n=int(input())
l=[input() for i in range(n)]
l.sort()
ll=list(set(l))
ll.sort()
m=len(ll)
ans=[0]*m
count=0
j=0
for i in range(len(l)-1):
  if l[i]==l[i+1]:
    count+=1
    if i+1==n-1:
      ans[j]+=count
  else:
    ans[j]+=count
    count=0
    j+=1
g=max(ans)
for i in range(m):
  if ans[i]==g:
    print(ll[i])
count = 0
ans = []
dic = {}
n = int(input())
for i in range(n):
    s = input()
    number = dic.get(s, 0) + 1
    count = max(count, number)
    dic[s] = number
for key in dic:
    if dic[key] == count:
        ans.append(key)
ans.sort()
for k in ans:
    print(k)
n = int(input())
s = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
ans = []
for i in range(n-1):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
    if max_count == 1:
      ans.append(s[i])
if max_count == 1:
  ans.append(s[n-1])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])
from collections import Counter
n=int(input())
s=[input() for _ in range(n)]
d=Counter(s)
m=max(d.values())
keys = [k for k,v in d.items() if v==m]
print("\n".join(sorted(keys)))
N = int(input())
D = {}
ans = []
ansval = 0
for _ in range(N):
    s = input()
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1
    if ansval == D[s]:
        ans.append(s)
    elif ansval < D[s]:
        ans = [s]
        ansval = D[s]
ans.sort()
for a in ans:
    print(a)
n = int(input())
d = {}

for _ in range(n):
    s = input()
    if(s in d):d[s] += 1
    else:d[s] = 1

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

m = d[0][1]
l = []
for i in range(len(d)):
    if(d[i][1] < m):break
    l.append(d[i][0])
l.sort()
for r in l:print(r)
N = int(input())
List_S = [input() for i in range(N)]
List_S.sort()
List_S.append(-1)

result = []
count_list = []
count = 1
for i in range(N):
    if List_S[i] == List_S[i + 1]:
        count += 1
    else:
        result.append(List_S[i])
        count_list.append(count)
        count = 1

ma = max(count_list)

for i in range(len(result)):
    if count_list[i] == ma:
        print(result[i])
import collections

n = int(input())
s = []
for i in range(n):
    si = input()
    s.append(si)
    
s.sort()
counted = collections.Counter(s)
M = max(counted.values())

ms = [k for k, v in counted.items() if v == M]
ms.sort()

for i in range(len(ms)):
    print(ms[i])
from operator import itemgetter
import datetime

n = int(input())
sn = dict()

for i in range(n):
    s = input()
    if(s in sn):
        sn[s] += 1
    else:
        sn[s] = 1

sn = sorted(sn.items(), key=lambda x:(-x[1],x[0]))
#print(sn)

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break
n = int(input())
s = [input() for i in range(n)]
s.sort()

poll = []
count = []
pre_poll = ''
for i in range(n):
    if pre_poll == s[i]:
        count[-1] += 1
    else:
        poll.append(s[i])
        count.append(1)
        pre_poll = s[i]
        
poll_dict = dict(zip(poll, count))
poll_dict = dict(sorted(poll_dict.items(), key=lambda x:x[1], reverse=True))

val = next(iter(poll_dict.values()))
for t in poll_dict.items():
    if val == t[1]:
        print(t[0])
    else:
        break
n = int(input())

d = {}
for i in range(n):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

m = max(d.values())
ans = []

for k, v in d.items():
  if v == m:
    ans.append(k)
ans.sort()
print(*ans, sep = "\n")
N = int(input())
S = []
for _ in range(N):
    S.append(input())

import collections    
C = collections.Counter(S)
M = C.most_common()[0][1]
R = [c for c in C.keys() if C[c]==M]
R.sort()

for r in R:
    print(r)
N=int(input())
S={}
for n in range(N):
  s=input()
  S[s]=S.get(s,0)+1

maxS=max(S.values())
S=[k for k,v in S.items() if v==maxS]
print('\n'.join(sorted(S)))
from itertools import groupby
N =int(input())
d = [input() for i in range(N)]

d.sort()
#print(d)
p=-1
b=[]
for key, value in groupby(d):
  a = len(list(value))
  if p<a:
    #print(p,len(list(value)))
    b=[]
    b.append(key)
    p=a
  elif p==a:
    #print(222)
    b.append(key)
for i in b:
  print(i)
import sys
N = int(input())
S = (str(x) for x in sys.stdin.read().split())
cnt = {}
for s in S:
  if cnt.get(s):
    cnt[s] = cnt[s] + 1
  else:
    cnt[s] = 1
max_cnt = max(cnt.values())
keys = [k for k, v in cnt.items() if v == max_cnt]
for k in sorted(keys):
  print(k)
Nu=int(input())
dic={}
ls=[]
maxd=0
for i in range(Nu):
  tmp=input()
  if tmp in dic:
    dic[tmp]=dic[tmp]+1
    maxd=max(dic[tmp],maxd)
  else:
    dic[tmp]=0
for k,v in dic.items():
  if v==maxd:
    ls.append(k)
ls.sort()
for x in ls:
  print(x)
N=int(input())
d=dict()
for _ in range(N):
    S=input()
    if S not in d:
        d[S]=0
    d[S]+=1
M=max(d.values())
ans=[]
for S in d.keys():
    if d[S]==M:
        ans.append(S)
ans.sort()
for S in ans:
    print(S)
from collections import Counter

n=int(input())
s=[ input() for i in range(n)]
dick=Counter(s)
dick=dick.most_common()
#print(dick)
#print(dick.values())
p=dick[0][1]

s=[]
for k,i in dick:
  if i==p:
    s.append(k)
  else:
    break
ss=sorted(s)
for i in ss:
  print(i)
N = int(input())
dictionary = {}
for i in range(N):
    S = input()
    if S not in dictionary.keys():
        dictionary[S] = 1
    else:
        dictionary[S] += 1


value_max = max(dictionary.values())

max_list = []
for k, v in dictionary.items():
    if v == value_max:
        max_list.append(k)

max_list.sort()
for i in max_list:
    print(i)
def main():
    n = int(input())
    cnt = {"":0}
    ans = 0

    for i in range(n):
        s = input()
        if cnt.get(s) == None:
            cnt[s] = 1
        else:
            cnt[s] += 1
        ans = max(ans, cnt[s])

    ls = []
    for k in cnt:
        if cnt[k] == ans:
            ls.append(k)

    ls.sort()

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

main()