PROGRAMMING:Dictionary
Because you have participated in many community exercises, you find that your C language has been greatly improved, so you start to check it now
Read more advanced dictionaries. In this dictionary, when you look up a word with another corresponding meaning (the title ensures that each word has only one corresponding meaning, that is, there will not be the case of "a" - > "B", "a" - > "C"), it means that you can use the new word instead of the original word to output. Otherwise, continue to use the original form of the word output.
###Input format:
In the first line, enter an integer n (1 < n < 10);
In the next N lines, enter two strings S1 for each line. S2 (separated by spaces) indicates that the previous word can be replaced by the latter word( 1Then enter an integer m (1 < = m < = 3)
Next, enter a string for each m line; The word waiting to be looked up.
###Output format:
In the M words that need to be looked up, if this word is found in the dictionary and there are other words corresponding to it, the output is in the
The corresponding word in the dictionary, otherwise output the original word; Each output takes one line.
###Input example:
Here is a set of inputs. For example:
```in
two
like love
love like
two
like
love
three
beauty pure
king queen
season summer
three
base
king
season
```
The corresponding output is given here. For example:
```out
love
like
base
queen
summer
```
answer:If there is no answer, please comment
Read more advanced dictionaries. In this dictionary, when you look up a word with another corresponding meaning (the title ensures that each word has only one corresponding meaning, that is, there will not be the case of "a" - > "B", "a" - > "C"), it means that you can use the new word instead of the original word to output. Otherwise, continue to use the original form of the word output.
###Input format:
In the first line, enter an integer n (1 < n < 10);
In the next N lines, enter two strings S1 for each line. S2 (separated by spaces) indicates that the previous word can be replaced by the latter word( 1
Next, enter a string for each m line; The word waiting to be looked up.
###Output format:
In the M words that need to be looked up, if this word is found in the dictionary and there are other words corresponding to it, the output is in the
The corresponding word in the dictionary, otherwise output the original word; Each output takes one line.
###Input example:
Here is a set of inputs. For example:
```in
two
like love
love like
two
like
love
three
beauty pure
king queen
season summer
three
base
king
season
```
The corresponding output is given here. For example:
```out
love
like
base
queen
summer
```
answer:If there is no answer, please comment