The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the company and the goods it produces) or its components: the name, the logo, the slogan. They decided to start with the name.

For this purpose the corporation has consecutively hired m designers. Once a company hires the i-th designer, he immediately contributes to the creation of a new corporation name as follows: he takes the newest version of the name and replaces all the letters x_{i} by y_{i}, and all the letters y_{i} by x_{i}. This results in the new version. It is possible that some of these letters do no occur in the string. It may also happen that x_{i} coincides with y_{i}. The version of the name received after the work of the last designer becomes the new name of the corporation.

Manager Arkady has recently got a job in this company, but is already soaked in the spirit of teamwork and is very worried about the success of the rebranding. Naturally, he can't wait to find out what is the new name the Corporation will receive.

Satisfy Arkady's curiosity and tell him the final version of the name.


-----Input-----

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 200 000) — the length of the initial name and the number of designers hired, respectively.

The second line consists of n lowercase English letters and represents the original name of the corporation.

Next m lines contain the descriptions of the designers' actions: the i-th of them contains two space-separated lowercase English letters x_{i} and y_{i}.


-----Output-----

Print the new name of the corporation.


-----Examples-----
Input
6 1
police
p m

Output
molice

Input
11 6
abacabadaba
a b
b c
a d
e g
f a
b b

Output
cdcbcdcfcdc



-----Note-----

In the second sample the name of the corporation consecutively changes as follows: $\text{abacabadaba} \rightarrow \text{babcbabdbab}$

$\text{babcbabdbab} \rightarrow \text{cacbcacdcac}$

$\text{cacbcacdcac} \rightarrow \text{cdcbcdcacdc}$

[Image]

[Image]

[Image]

Difficulty: interview

Starter code:

Solutions:
# import sys
# sys.stdin = open('cf591b.in')

n, m = map(int, input().split())
s = input()

perm = list(range(26))

v = ord('a')

for _ in range(m):
	ss = input()
	i, j = (ord(ss[0]) - v, ord(ss[2]) - v)
	perm[i], perm[j] = perm[j], perm[i]

rev = [perm.index(c) for c in range(26)]
print(''.join(chr(rev[ord(c) - v] + v) for c in s))

A = list("abcdefghijklmnopqrstuvwxyz")
n, m = map( int, input().split() )
name = input()

for i in range( m ) :
    s = input()
    x, y = s[0], s[2]

    x_index = A.index( x )
    y_index = A.index( y )

    A[x_index], A[y_index] = A[y_index], A[x_index]

for c in name :
    index = ord( c ) - ord( 'a' )
    print( A[index], end='')


n, m = list(map(int, input().split(' ')[:2]))
s = input()[:n]

ls = {}

for c in s:
    ls[c] = c

for i in range(m):
    x, y = input().split(' ')[:2]
    if x not in ls:
        ls[x] = x
    if y not in ls:
        ls[y] = y
    ls[x], ls[y] = ls[y], ls[x]

rev = {}
for c, v in list(ls.items()):
    rev[v] = c

print(''.join([rev[c] for c in s]))


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
N,M = list(map(int,input().split()))
name=input()

table = [0] * 26
for i in range(26):
    table[i] = i

buffs = []
for _ in range(M):
    before,after = list(map(ord, input().split()))
    before -= ord('a')
    after -= ord('a')
    buffs.append((before,after))
buffs.reverse()

for pair in buffs:
    table[pair[0]], table[pair[1]] = table[pair[1]], table[pair[0]]

ret = ""
for ch in name:
    ret += chr( table[ ord(ch) - ord('a') ] + ord('a') )

print(ret)    



    
    


import sys


#sys.stdin = open("input.txt")
#sys.stdout = open("output.txt", "w")

n, m = [int(x) for x in input().split()]
s = input()
c1 = ord('a')
c2 = ord('z')
ma = [i for i in range(c2-c1+1)]
where = [i for i in range(c2-c1+1)]
for i in range(m):
	cf, cs = [ord(c) for c in input().split()]
	wcf = where[cf - c1]
	wcs = where[cs - c1]
	ma[wcf], ma[wcs] = ma[wcs], ma[wcf]
	where[cf - c1], where[cs - c1] = where[cs - c1], where[cf - c1]

ans = []
for c in s:
	cur = ord(c)
	ans.append(chr(ma[cur-c1] + c1))

print(''.join(ans))



#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""

from string import ascii_lowercase
l = ascii_lowercase

[n, m] = list(map(int, input().split()))
s = input()

a = [None] * n

for i in range(n):
    a[i] = l.index(s[i])

alpha = [i for i in range(26)]

for i in range(m):
    al, bl = input().split()

    ai = l.index(al)
    bi = l.index(bl)

    ai = alpha.index(ai)
    bi = alpha.index(bi)

    alpha[ai], alpha[bi] = alpha[bi], alpha[ai]


for i in range(n):
    print(l[alpha[a[i]]], end="")
print()


3

c = 26*[0]
ind = 26*[0]
for i in range(26):
	c[i] = chr(i+97)
	ind[i] = i
n,m = map(int, input().split())
s = input()
size = len(s)
s1 = size*[0]
for _ in range(m):
	x,y = input().split()
	c[ind[ord(x)-97]] = y
	c[ind[ord(y)-97]] = x
	ind[ord(x)-97],ind[ord(y)-97] = ind[ord(y)-97],ind[ord(x)-97]
for i in range(size):
	s1[i] = c[ord(s[i])-97]
print (('').join(s1))

import string
N, M = list(map(int, input().split()))
S = input()
dic = string.ascii_lowercase
for _ in range(M):
    x, y = input().split()
    dic = dic.translate(str.maketrans(x+y, y+x))
print(S.translate(str.maketrans(string.ascii_lowercase, dic)))


#!/usr/bin/env python
# -*- coding: utf-8 -*-

n, m = list(map(int,input().split()))
S = input()
char = {chr(i) : chr(i) for i in range(ord('a'), ord('z')+1 )}
keys = list(char.keys())

for i in range(m):
    x, y = input().split()
    for c in keys:
        if char[c] == x:
            char[c] = y
        elif char[c] == y:
            char[c] = x

ans = []
for c in list(S):
    ans.append(char[c])
print(''.join(ans))


import sys
import string
read = lambda: list(map(int, sys.stdin.readline().split()))

n, m = read()
s = sys.stdin.readline().strip()
design = {c:c for c in string.ascii_lowercase}
for i in range(m):
   a, b = sys.stdin.readline().split()
   design[a], design[b] = design[b], design[a]
design2 = {b:a for a,b in list(design.items())}
print(''.join(design2[c] for c in s))



n, m = list(map(int, input().split()))
s = input()
k = []
a = ['' for i in range(m)]
b = ['' for i in range(m)]
ans = [0 for i in range(n)]
for i in range(n):
    k.append(s[i])
d = {}
for i in range(26):
    d[chr(ord('a') + i)] = 0
for i in range(m):
    a[i], b[i] = list(map(str, input().split()))

for i in range(26):
    cur = chr(ord('a') + i)
    for j in range(m):
        if a[j] == cur or b[j] == cur:
            if a[j] == cur:
                cur = b[j]
            else:
                cur = a[j]
    d[chr(ord('a') + i)] = cur
used = [True for i in range(n)]
for i in range(26):
    for j in range(n):
        if s[j] == chr(ord('a') + i) and used[j] == True:
            ans[j] = d[chr(ord('a') + i)]
            used[j] = False
print(''.join(str(i) for i in ans))
            
    



n, m = list(map(int, input().split()))

alpha_cnst = list("abcdefghijklmnopqrstuvwxyz")
alpha = list("abcdefghijklmnopqrstuvwxyz")

s = input()

for i in range(m) :
    a, b = input().split()
    for j in range(len(alpha)) :
        if alpha[j] == a : alpha[j] = b
        elif alpha[j] == b : alpha[j] = a
total = ''
for char in s :
    total += alpha[alpha_cnst.index(char)]
print(total)


n, m = map(int, input().split())
s = input()

d = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    d[i] = []

for j, l in enumerate(s):
    d[l].append(j)

for i in range(m):
    xi, yi = input().split()
    d[xi], d[yi] = d[yi], d[xi]

r = {}
for k, v in d.items():
    for pos in v:
        r[pos] = k

for l in sorted(r.items()):
    print(l[1], end="")


def solve():
    N, M = list(map(int, input().split()))
    name = input()

    td = {}
    for c in 'abcdefghijklmnopqrstuvwxyz':
        td[c] = c

    for i in range(M):
        p, m = input().split()
        if p == m:
            continue
        pt = td[p]
        mt = td[m]
        del td[p]
        del td[m]
        td[m] = pt
        td[p] = mt

    nd = {f: t for t, f in list(td.items())}

    ans = ''.join([nd[c] for c in name])

    print(ans)


def __starting_point():
    solve()

__starting_point()

n, m = map(int,input().split())
in_s = input()
renames_str = [input() for i in range(m)]

rule = {}
rule_inv = {}
for i in range(26):
	c = chr(ord('a') + i)
	rule[c] = c
	rule_inv[c] = c

for x in renames_str:
	a, b = x.split()
	for k,v in rule.items():
		if v == a:
			rule[k] = b
		if v == b:
			rule[k] = a

for c in in_s:
	print(rule[c], end="")
print()


#In the name of Allah

from sys import stdin, stdout
input = stdin.readline
d = {'x': 'x', 'y': 'y', 'z': 'z', 'p': 'p', 'q': 'q', 'r': 'r', 's': 's', 't': 't', 'u': 'u', 'v': 'v', 'w': 'w', 'h': 'h', 'i': 'i', 'j': 'j', 'k': 'k', 'l': 'l', 'm': 'm', 'n': 'n', 'o': 'o', 'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd', 'e': 'e', 'f': 'f', 'g': 'g'}
n, m = list(map(int, input().split()))

s = input()

xy = [input()for i in range(m)]

for i in d:
        t = i
        for j in xy:
                if j[0] == t:
                        t = j[2]
                elif j[2] == t:
                        t = j[0]
        d[i] = t
                        
        
for i in range(n):
        stdout.write(d[s[i]])



import string

n,m = map(int, input().split())
s = input()

chars = string.ascii_lowercase

for _ in range(m):
    a,b = input().split()
    chars = chars.replace(a, "%").replace(b,a).replace("%",b)

replacements = {ord(string.ascii_lowercase[i]):chars[i] for i in range(26)}

print(s.translate(replacements))

from math import sqrt, pow, log, log2, log10, exp
from copy import deepcopy
from fractions import gcd


def read_ints():
    return list(map(int, input().split()))


def read_int():
    return read_ints()[0]


def read_floats():
    return list(map(float, input().split()))


def read_float():
    return read_floats()[0]


def format_list(l):
    return ' '.join(list(map(str, l)))


def one_dim_array(n, value=0):
    return [deepcopy(value) for x in range(n)]


def two_dim_array(n, m, value=0):
    return [[deepcopy(value) for x in range(m)] for x in range(n)]


def is_prime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, sqrt(n) + 1):
        if n % i == 0:
            return False
    return True


def max_len_sublist(l, f):
    start, max_length, length = 0, 0, 0
    for i in range(1, len(l)):
        if f(l[i], l[i - 1]):
            length += 1
        else:
            if max_length < length:
                start = i - length
                max_length = length
            length = 0
    return start, max_length


def tf_to_yn(b):
    return 'YES' if b else 'NO'


def longest_non_descent_subsequence(s, restore_sequence=False):
    d = one_dim_array(len(s), 0)
    for i in range(len(s)):
        possible = [d[j] + 1 if s[j] <= s[i] else 1 for j in range(i)]
        d[i] = 1 if len(possible) == 0 else max(possible)

    if not restore_sequence:
        return d[-1] if len(d) != 0 else 0


def update_ch(ch, f, t):
    addedf = False
    addedt = False
    for key in list(ch.keys()):
        value = ch[key]
        if value == f:
            ch[key] = t
            addedf = True
        if value == t:
            ch[key] = f
            addedt = True
    if not addedf:
        ch[f] = t
    if not addedt:
        ch[t] = f

    return ch


n, m = read_ints()
s = list(input())
ch = {}

for i in range(1, m + 1):
    f, t = input().split()
    if f != t:
        update_ch(ch, f, t)


def map_with_ch(ch, x):
    if x in ch:
        return ch[x]
    else:
        return x


print(''.join(list([map_with_ch(ch, x) for x in s])))


n,m=list(map(int,input().split()))
s=input()
p=[chr(i) for i in range(97,97+26)]
for i in range(m):
    a,b=input().split()
    for i in range(26):
        if p[i]==a: p[i]=b
        elif p[i]==b: p[i]=a
print("".join([p[ord(x)-97] for x in s]))


inp=input().strip().split()
n,m=int(inp[0]),int(inp[1])
s=input().strip()
d={}
for i in range(n):
    if(s[i] in d):
        d[s[i]].append(i)
    else:
        d[s[i]]=[i]

for i in range(m):
    inp=input().strip().split()
    l0,l1=[],[]
    b0,b1=False,False
    if(inp[0] in d):
        #l0=d[inp[0]]
        b0=True
    if(inp[1] in d):
        #l1=d[inp[1]]
        b1=True
    if(b0 and b1):
        d[inp[0]],d[inp[1]]=d[inp[1]],d[inp[0]]
    elif(b0 and (not b1)):
        d[inp[1]]=d[inp[0]]
        del(d[inp[0]])
    elif(b1 and (not b0)):
        d[inp[0]]=d[inp[1]]
        del(d[inp[1]])
        
        

ans=[0]*n
for key in d.keys():
    for i in d[key]:
        ans[i]=key

for ctmp in ans:
    print(ctmp,end='')
print()
            
    


n,m = list(map(int, input().split()))
ch = str(input())
res = [ch[k] for k in range(n)]
X = ["" for _ in range(m)]
Y = ["" for _ in range(m)]
for k in range(m):
    s = str(input()) 
    X[k] = s[0]
    Y[k] = s[2]

al = "abcdefghijklmnopqrstuvwxyz"
A = [al[k] for k in range(26)]
B = A[:]
for k in range(m):
    a = A.index(X[k])
    b = A.index(Y[k])
    c = A[a]
    A[a] = A[b]
    A[b] = c            
for j in range(n):
    a = B.index(res[j])
    res[j] = A[a]
    
ch = ""
for k in range(n):
    ch  = ch + res[k]
print(ch)


import string
n, m = input().split()
n, m = [int(n), int(m)]
name = input()
name = list(name)
buffer = {}
for ch in list(string.ascii_lowercase):
  buffer[ch] = [] 
for i in range(n):
  buffer[name[i]].append(i)
for j in range(m):
  xi, yi = input().split()
  temp = buffer[xi]
  buffer[xi] = buffer[yi]
  buffer[yi] = temp
for key, value in list(buffer.items()):
  for i in value:
    name[i] = key
name = "".join(name)
print(name)


n, m = map(int, input().split())
original_name = input()
changes = [input().split() for _ in range(m)]

original_char_dict_list = sorted(list(set(original_name)))
modified_char_dict_list = sorted(list(set(original_name)))

for pair in changes:
    for i, c in enumerate(modified_char_dict_list):
        if c == pair[0]:
            modified_char_dict_list[i] = pair[1]
        elif c == pair[1]:
            modified_char_dict_list[i] = pair[0]

dictionary = {c: modified_char_dict_list[i] for i, c in enumerate(original_char_dict_list)}
name_list = list(original_name)

for i, c in enumerate(name_list):
    name_list[i] = dictionary[c]

print(''.join(name_list))

n, m = list(map(int, input().split()))
s = input()
orig = 'abcdefghijklmnopqrstuvwxyz'
after = orig
for _ in range(m):
    xi, yi = input().split()
    after = after.translate(str.maketrans(xi + yi, yi + xi))

print(s.translate(str.maketrans(orig, after)))


n, m = map(int, input().split())
s = input()
w = list(range(26))
for i in range(m):
    a, b = input().split()
    c, d = ord(a) - ord('a'), ord(b) - ord('a')
    w[c], w[d] = w[d], w[c]
t = { chr(w[c] + ord('a')): chr(c + ord('a')) for c in range(26) }
for c in s:
    print(t[c], end="")
print()