Character Conversion

No attempts yetTime limit1sMemory limit128 MB

Problem

Write a program that converts data according to a given conversion table.

Each character used in the data is a letter or a digit; letters are case-sensitive (uppercase and lowercase are distinguished). The characters listed in the conversion table appear in no particular order.

Each row of the conversion table contains two single characters (not strings) separated by a space: a source character and a target character. Whenever the source character of some row appears in the data, that character is replaced by the corresponding target character and printed. Each conversion happens exactly once: even if a converted character then matches the source character of some row, it is not converted again. A character that does not appear in the conversion table is printed unchanged.

Input

The first line contains the number of rows $n$ in the conversion table. Each of the next $n$ lines contains two characters (a source character and a target character) separated by a space. The next line contains the number of data lines $m$ ($m < 10^8$), and each of the following $m$ lines contains a single character.

Output

Print the converted string on a single line with no spaces or line breaks in the middle, followed by a trailing newline.