문제 링크 - https://www.acmicpc.net/problem/1302
n = int(input())
books = {}
for _ in range(n):
book = input()
if book not in books:
books[book] = 1
else:
books[book]+=1
print(sorted(books.items(), key = lambda x: (-x[1], x[0]))[0][0])