Andi and Bob were friends since childhood days. But, as they grew up Bob started behaving weird and this used to irritate Andi. Once, while Andi took a break after typing a large program Bob came from nowhere and swapped some alphabet keys on Andi's keyboard.

Andi got very angry on seeing this and decided to end their friendship once forever. As we all know Bob is very good at heart and never does anything wrong intentionally. He decided to type the remaining program with the same keyboard Configuration.
Given the original fragment of the code that Bob needs to type, You need to tell Bob the code that he should type to get the original code as output.

Help him saving his friendship with Andi.

INPUT  :

First line of the input contains a single integer N denoting the number of swaps done by Bob. Next N lines contain a pair of characters A,B denoting the characters which are swapped by Bob (Note that Bob performs these swaps in the given order).
From the very next line of input the remaining fragment of the code starts and ends with an end of file character.

OUTPUT:

print the fragment of the program that Bob types.

CONSTRAINTS:

1 ≤ N ≤ 10^6

1 ≤ |length of codefragment| ≤ 10^6

code fragment contains uppercase and lowercase english alphabets only and space.

A,B belongs to Alphabet set (both upper case and lower case letters are included).

SAMPLE INPUT
1
W H
WelloHorld

SAMPLE OUTPUT
HelloWorld

Explanation

For the given test case:

Letter W is swapped with the letter H. So, to type WelloHorld Bob must type HelloWorld on Andi's keyboard.
no_of_replace_chars =int(raw_input())
replace_strings = list()
for x in range(no_of_replace_chars):
	replace_strings.append(raw_input())

s = raw_input()

d = dict()
for key, value in enumerate(s):
	if d.has_key(value):
		d[value].append(key)
	else:
		d[value] = [key]
temp = "temp"
for r_str in replace_strings:
	r_s = r_str.split(" ")
	first = r_s[0]
	second = r_s[1]
	lower_first = r_s[0].lower()
	lower_second = r_s[1].lower()
	if d.has_key(first):
		if not d.has_key(second):
			d[second] = d[first]
			del d[first]
		else:
			temp = d[first]
			d[first] = d[second]
			d[second] = temp
	elif d.has_key(second):
		d[first] = d[second]
		del d[second]

	if d.has_key(lower_first) :
		if not d.has_key(lower_second):
			d[lower_second] = d[lower_first]
			del d[lower_first]
		else:
			temp = d[lower_first]
			d[lower_first] = d[lower_second]
			d[lower_second] = temp
	
	elif d.has_key(lower_second):
		d[lower_first] = d[lower_second]
		del d[lower_second]

del temp	
final_str =  range(len(s))
for key, values in d.items():
	for x in values:
		final_str[x]=key
print "".join(final_str )