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.
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 the final rating in the same format as in the input.