The Live Hit Parade

A local radio station runs a wild live chart. Listeners text in votes for their favorite song, and the host instantly announces the current top song after each vote.

Your job is to keep the scoreboard and tell the host what to say after every single vote.

The first line of the input contains a single integer n - the number of incoming votes.

The second line contains n space-separated song names (lowercase strings without spaces), in the exact order the votes arrive.

After processing each vote, the program should print the name of the song that is currently in the lead among all votes so far. If several songs are tied for first place, announce the alphabetically smallest one.

Input

Output

10
starlight echo echo comet starlight echo comet comet comet echo

starlight
echo
echo
echo
echo
echo
echo
comet
comet
comet

7
aria ballad beat beat ballad aria aria

aria
aria
aria
beat
ballad
aria
aria

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