Now that Griffy has a list of who he wants to make friends with, he needs to prepare a speech to win over their friendship! Unfortunately, Griffy is not the best public speaker, so you've agreed to help correct and improve his speech! You have a list of "friendship" words that you would like to replace some "not-so-friendship" words in Griffy's speech with. Given distinct "friendship" words and the distinct words they will replace, please find out the new and improved speech.
Input Specification
First line: one integer .
Lines to : two words space separated: a "friendship" word and a "not-so-friendship" word.
Next line: one string, the speech, up to words long separated by spaces. The string will be terminated with a period.
Note: All words will be at most 20 characters long, composed of lowercase alphabetical characters.
Output Specification
One string, the speech with all "not-so-friendship" words replaced with their "friendship" word counterpart.
Sample Input
2
hello uh
exactly uhm
uh what uh are uhm you doing uhh.
Sample Output
hello what hello are exactly you doing uhh.
Comments