In Australian voting, each voter ranks all candidates in order of preference. Counting proceeds in rounds:
The first line contains an integer $n$ ($1 \le n \le 20$), the number of candidates. Each of the next $n$ lines gives a candidate's name; a name may be up to 80 characters long and may contain any printable characters, including spaces. Up to 1000 ballots follow, one per line. Each ballot lists the integers $1$ through $n$ in some order: the first integer is the voter's first choice, the second integer the second choice, and so on.
Print a single line with the name of the winner. If the process ends in a tie, print the name of every tied candidate on its own line, in the same order the candidates were given in the input.