Predictive Algorithms

Predictive algorithms are simple rules that use what happened before to make a good guess about what might happen next. They power everyday tools: apps recommend videos you’ll enjoy, email filters catch spam, maps estimate your arrival time, stores plan how many items to stock, banks spot suspicious card charges, hospitals flag patients who may need extra care, energy teams forecast tomorrow’s demand, and support desks route tickets to the right team. The same idea shows up in research and industry projects alike - anywhere a past-to-future pattern helps people decide faster and better.

First Challenge: The Best Snack

The company you work for has a snack cart in the office with different snacks. Employees love taking those snacks during the day, but some snacks run out faster than others.

So, the company decides to order an additional shelf of the most popular snack for today, based on what people chose from the snack cart yesterday.

They ask you to help them predict the most popular snack based on yesterday's data.

snacks.jpg

The first line of the input contains a single integer n representing the number of snacks employees ate yesterday.

The second line contains n space-separated snack names (the snack names don't contain spaces).

The program should print the name of the snack that the company should order to put on the additional shelf. In case there are several equally popular candidates, the program should print the alphabetically smallest one.

Input

Output

5
cookie cookie chips banana cookie

cookie

7
chips apple chips banana apple chips apple

apple

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue