Frequent Flyer


Problem Statement

Jackson is a frequent flyer and has been to many places around the world!

Jackson has a list of nn destinations he has flown to in the past. He wants to know which place he has flown to the most!

You are given a list of nn flight destinations you have been to in the past, output the most frequent place you have flown to.

Input

Your first line of input will contain a single integer nn: the number of destinations flown to in total. Next, nn lines will follow, each containing a single string fif_i: the name of a destination each.

Output

A single line, containing the name of the most frequent place Jackson has flown to.

If there is a tie, choose the place with the lexicographically (alphabetically) smallest name.

Constraints

  • 1n1051 \leq n \leq 10^5
  • 1fi1001 \leq |f_i| \leq 100
  • Each fif_i only contains English lower-case alphabet letters.

Example 1

Input 1
10
japan
hongkong
japan
hongkong
france
germany
france
germany
japan
japan
Output 1
japan
Explanation

Japan appeared more than any other location.

Example 2

Input 2
4
asia
asia
antarctica
antarctica
Output 2
antarctica
Explanation

There are 22 places with the same number of flights flown to them.

Antartica is the alphabetically smaller destination, so it should be the final output over everything else.

Template

Code 1
n = int(input())
f = [input() for _ in range(n)]
# Continue your code here and print your final answer!

Solution

If you'd like to view a sample solution to this tutorial question, please click the "Read Editorial" link to the right of the problem!

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.