281. Championship
Time limit per test: 0.5 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



N teams participate in a championship. It consists of two contests; each of the teams participates in both. Each contest has its own rating. Then the final rating is made. If for some M (1≤ M≤ N) the sets of first M teams in both ratings are the same, then this set is the set of the first M teams in the final rating. Teams whose relative order cannot be determined using this rule are placed in alphabetical order.

You are given the contests' ratings. Your task is to generate the final rating.

Input
The first line of the input contains an integer N (1≤ N≤ 50000). The two ratings follow. Each of the ratings consists on N lines, each of which contains a team's name, being a string of at most 20 lowercase Latin letters and digits.

Output
Output the final rating in the same format as in the input.

Example(s)
sample input
sample output
6
spbifmo1
msu1
msu2
permsu
nsu1
nnsu
spbifmo1
msu1
permsu
msu2
nnsu
nsu1
spbifmo1
msu1
msu2
permsu
nnsu
nsu1



Novosibirsk SU Contest #2, by Novosibirsk Team #1
