from collections import Counter
import heapq

n = int(input())
sc = Counter()

for x in range(n):
  s = input()
  sc.update([s])

max_num = sc.most_common()[0][1]
q = []
for v in sc.items():
  if v[1] == max_num:
    heapq.heappush(q, v[0])

for _ in range(len(q)):
  print(heapq.heappop(q))
 from collections import Counter import heapq heapq n = int(input()) n int(input()) int input() input sc = Counter() sc Counter() Counter for x in range(n):
  s = input()
  sc.update([s]) x range(n) range n s = input() s input() input sc.update([s]) sc.update sc update [s] s max_num = sc.most_common()[0][1] max_num sc.most_common()[0][1] [0] sc.most_common() sc.most_common sc most_common 0 1 q = [] q [] for v in sc.items():
  if v[1] == max_num:
    heapq.heappush(q, v[0]) v sc.items() sc.items sc items if v[1] == max_num:
    heapq.heappush(q, v[0]) v[1] == max_num v[1] v 1 max_num heapq.heappush(q, v[0]) heapq.heappush heapq heappush q v[0] v 0 for _ in range(len(q)):
  print(heapq.heappop(q)) _ range(len(q)) range len(q) len q print(heapq.heappop(q)) print heapq.heappop(q) heapq.heappop heapq heappop q sc = Counter() Counter() sc s = input() input() s q = [] [] q max_num = sc.most_common()[0][1] sc.most_common()[0][1] max_num n = int(input()) int(input()) n
from collections import Counter
import heapq

n = int(input())
sc = Counter()

for x in range(n):
  s = input()
  sc.update([s])

max_num = sc.most_common()[0][1]
q = []
for v in sc.items():
  if v[1] == max_num:
    heapq.heappush(q, v[0])

for _ in range(len(q)):
  print(heapq.heappop(q))

