|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||117||52||42||48.837%|
After NASA discovered water on Mars, they decided to expand their exploration hoping to find some alien intelligence on the planet. After months of exploration, they were actually surprised to find out that the planet has been inhabited by minions.
NASA started communications with the minions and the first message they received was Mo amo Banana. At first, it was really hard to decipher the message but after sometime they managed to workout a dictionary that maps English words to Minionese words. You are going to help NASA build the translator to ease their communication with Minions for the good and prosperity of mankind and minionkind.
The first line of input will contain a single integer N, the number of words in the dictionary (1 ≤ N ≤ 100). The following N lines will each contain a sentence of the format x = y where x is an English word and y is a Minionese word. The next line will contain an integer T, the number of test cases (1 ≤ T ≤ 100). Each test case will start with a line containing an integer K, the number of words in the sentence (1 ≤ K ≤ 100) and the next line will contain K space separated English words. All the English words in the test cases exist in the defined dictionary. Also, all the words consist only of English alphabet, and will be at most 20 characters long.
For each test case, print a single line containing the space separated Minionese words after translation.
4 I = mo love = amo icecream = gelatooo banana = banana 2 3 I love banana 3 I love icecream
mo amo banana mo amo gelatooo