n = int(eval(input()))

dic = {}

val_set = set()

ans = []



for i in range(n):

  temp = eval(input())

  try:

    dic[temp] += 1

  except:

    dic[temp] = 1



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



for key,val in dic:

  val_set.add(val)

  if len(val_set) == 2:

    break

  else:

    ans.append(key)

  

ans = sorted(ans)



for x in ans:

  print(x)
from collections import Counter



n = int(input())

s = [input() for _ in range(n)]



counter = Counter(s)

max_cnt = max(counter.values())



names = [name for name,val in counter.items() if val==max_cnt]

names.sort()



print(*names, sep='\n')

n = int(eval(input()))
dic = {}
val_set = set()
ans = []
for i in range(n):
    temp = eval(input())
    try:
        dic[temp] += 1
    except:
        dic[temp] = 1
dic = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)
for key, val in dic:
    val_set.add(val)
    if len(val_set) == 2:
        break
    else:
        ans.append(key)
ans = sorted(ans)
for x in ans:
    print(x)

from collections import Counter

n = int(input())
s = [input() for _ in range(n)]
counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, val in counter.items() if val == max_cnt]
names.sort()
print(*names, sep="\n")

-n = int(eval(input())) -dic = {} -val_set = set() -ans = [] -for i in range(n): -    temp = eval(input()) -    try: -        dic[temp] += 1 -    except: -        dic[temp] = 1 -dic = sorted(list(dic.items()), key=lambda x: x[1], reverse=True) -for key, val in dic: -    val_set.add(val) -    if len(val_set) == 2: -        break -    else: -        ans.append(key) -ans = sorted(ans) -for x in ans: -    print(x) +from collections import Counter + +n = int(input()) +s = [input() for _ in range(n)] +counter = Counter(s) +max_cnt = max(counter.values()) +names = [name for name, val in counter.items() if val == max_cnt] +names.sort() +print(*names, sep="\n")