Time limit per test: 3 seconds Memory limit: 64 megabytes
input: standard output: standard
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 () the sets of first teams in both ratings are the same, then this set is the set of the first 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 (). The two ratings follow. Each of the ratings consists on 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.