Are you going to Scarborough Fair?

Parsley, sage, rosemary and thyme.

Remember me to one who lives there.

He once was the true love of mine.

Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get there.

Willem asks his friend, Grick for directions, Grick helped them, and gave them a task.

Although the girl wants to help, Willem insists on doing it by himself.

Grick gave Willem a string of length n.

Willem needs to do m operations, each operation has four parameters l, r, c_1, c_2, which means that all symbols c_1 in range [l, r] (from l-th to r-th, including l and r) are changed into c_2. String is 1-indexed.

Grick wants to know the final string after all the m operations.


-----Input-----

The first line contains two integers n and m (1 ≤ n, m ≤ 100).

The second line contains a string s of length n, consisting of lowercase English letters.

Each of the next m lines contains four parameters l, r, c_1, c_2 (1 ≤ l ≤ r ≤ n, c_1, c_2 are lowercase English letters), separated by space.


-----Output-----

Output string s after performing m operations described above.


-----Examples-----
Input
3 1
ioi
1 1 i n

Output
noi
Input
5 3
wxhak
3 3 h x
1 5 x a
1 3 w g

Output
gaaak


-----Note-----

For the second example:

After the first operation, the string is wxxak.

After the second operation, the string is waaak.

After the third operation, the string is gaaak.

Difficulty: interview

Starter code:

Solutions:
n, m = list(map(int, input().split()))
s = list(input())
a = []
for _ in range(m):
	l, r, c1, c2 = input().split()
	l, r = int(l) - 1, int(r) - 1
	for i in range(l, r + 1):
		if s[i] == c1:
			s[i] = c2
print(''.join(s))



import sys
sys.setrecursionlimit(100000000)
# def input(): return sys.stdin.readline()[:-1]
def iin(): return int(input())
def impin(): return list(map(int, input().split()))
def irrin(): return [int(x) for x in input().split()]
def imrin(n): return [int(input()) for _ in range(n)]


n, m = impin()
s = [x for x in input()]
for _ in range(m):
    l, r, c1, c2 = input().split()
    for i in range(int(l)-1, int(r)):
        if s[i]==c1:
            s[i] = c2
print(''.join(s))


n,m=map(int,input().split())
s=input()
for x in range(m):
    l,r,c1,c2=input().split()
    l=int(l)
    r=int(r)
    s=s[:l-1]+s[l-1:r].replace(c1,c2)+s[r:]
print(s)

n,m = list(map(int,input().split()))
s = input()
li = list(s)
for i in range(m):
	l,r,c1,c2 = input().split()
	for i in range(int(l)-1,int(r)):
		if li[i]==c1:
			li[i]=c2
print("".join(li))


from itertools import *


n, m = list(map(int, input().split()))
s = input()
for _ in range(m):
    l, r, c1, c2 = input().split()
    l = int(l)
    r = int(r)
    s = s[:l-1] + s[l-1:r].replace(c1, c2) + s[r:]
print(s)


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

s = list(input().strip())

for _ in range(m):
    l,r,c1,c2 = list(input().strip().split())
    for k in range(int(l)-1, int(r)):
        if s[k] == c1:
            s[k] = c2

print(''.join(s))





n,m=list(map(int,input().split()))
s=input()
for _ in range(m):
	l,r,c1,c2=input().split()
	l,r=int(l),int(r)
	s=s[:l-1]+s[l-1:r].replace(c1,c2)+s[r:]
print(s)


# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys

"""
created by shhuan at 2017/12/2 22:05

"""


N, M = map(int, input().split())

S = list(input())

for i in range(M):
    l, r, c1, c2 = input().split()
    l, r = int(l), int(r)

    for j in range(l-1, r):
        if S[j] == c1:
            S[j] = c2

print("".join(S))

# Main maut ko takiya, aur kafan ko chaadar banakar audhta hoon!

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

s=input()

for i in range(m):
	a,b,c,d=input().split()
	s=s[:int(a)-1]+s[int(a)-1:int(b)].replace(c,d)+s[int(b):]
	
print(s)

import itertools
import re
import math
import getpass
import sys
import string

debug = getpass.getuser() == 'frohe'
files = True

if debug and files:
    sys.stdin = open('test.in')
else:
    pass
    # sys.stdin = open('schools.in')
    # sys.stdout = open('schools.out', 'w')


def ria():
    return [int(i) for i in input().split()]


n, m = ria()
st = input()

for i in range(m):
    l, r, a, b = input().split()
    l = int(l)
    r = int(r)
    l-=1
    st=st[:l]+st[l:r].replace(a,b)+st[r:]
print(st)

n, m = list(map(int, input().split()))
s = list(input())
for i in range(m):
    l, r, c1, c2 = input().split()
    l, r = list(map(int, (l,r)))
    for j in range(l-1, r):
        if s[j] == c1:
            s[j] = c2
print(''.join(s))


n,m = [int(x) for x in input().split()]
s = [c for c in input()]
oper = []
for _ in range(m):
    a,b,c,d = input().split()
    a = int(a)
    b = int(b)
    oper.append((a,b,c,d))

for op in oper:
    l,r,c1,c2 = op
    for i in range(l-1,r):
        if s[i]==c1:
            s[i] = c2
print("".join(s))




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

A = input()

for _ in range(m):
    l, r, c_1, c_2 = input().split()
    l = int(l)
    r = int(r)
    for i in range(l - 1, r):
        if A[i] == c_1:
            A = A[:i] + c_2 + A[i + 1:]

print(A)


n, m = list(map(int, input().split()))
s = input()
for i in range(m):
	l, r, c1, c2 = input().split()
	l = int(l)
	r = int(r)
	s = s[:l - 1] + s[l - 1:r].replace(c1, c2) + s[r:]
print(s)

n, m = map(int, input().split())
s = list(input())
for _ in range(m):
    l, r, a, b = input().split()
    l, r = map(int, (l, r))
    for i in range(l - 1, r):
        if s[i] == a:
            s[i] = b

print("".join(s))

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

s = [c for c in input()]

for _ in range(m):
    l,r,a,b = input().split()
    l = int(l)-1
    r = int(r)

    for i in range(l,r):
        if s[i] == a:
            s[i] = b
print(''.join(s))


n, m = map(int, input().split())
s = list(input())
for i in range(m):
    l, r, c1, c2 = input().split()
    for j in range(int(l) - 1, int(r)):
        if s[j] == c1:
            s[j] = c2
print(''.join(s))

N, K = list(map(int, input().split()))
string = input()

for _ in range(K):
    fr, to, c1, c2 = input().split()
    fr, to = int(fr), int(to)
    fr, to = fr - 1, to - 1

    for i in range(fr, to+1):
        if string[i] == c1:
            string = string[:i] + c2 + string[i+1:]

print(string)
    






def main():
    n, m = map(int, input().split())
    s = list(input())
    for i in range(m):
        l, r, c1, c2 =input().split()
        l = int(l)
        r = int(r)
        for i in range(l - 1, r):
            if s[i] == c1:
                s[i] = c2

    print(''.join(s))



def __starting_point():
    try:
        main()
    except KeyboardInterrupt:
        pass
__starting_point()

n, q = map(int, input().split())
s = input()
for _ in range(q):
    l,r,c1,c2 = input().split()
    l , r = int(l), int(r)
    s = [c2 if i+1 >= l and i+1<=r and s[i] == c1 else s[i] for i in range(len(s))]
print(''.join(s))

import sys

sys.setrecursionlimit(100000000)

# def input():
#     return sys.stdin.readline()[:-1]


N, M = map(int, input().split())
line = [x for x in input()]
for t in range(M):
    l, r, c1, c2 = map(str, input().split())
    l = int(l)
    r = int(r)
    for i in range(l-1, r):
        if line[i] == c1:
            line[i] = c2

print(''.join(line), flush=True)


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

for i in range(m):
    l, r, c1, c2 = input().split()
    l, r = int(l), int(r)
    for j in range(l - 1, r):
        el = line[j]
        if el == c1:
            line[j] = c2

print(''.join(line))


n, m = list(map(int, input().split()))
s = list(input())
for _ in range(m):
    l, r, c1, c2 = input().split()
    for i in range(int(l) - 1, int(r)):
        if s[i] == c1:
            s[i] = c2
print(''.join(s))


a=input().split(' ')
a=[int(i) for i in a]
s=input()
w=[]
for i in s:
    w.append(i)
for _ in range(a[1]):
    q=input().split(' ')
    for i in range(int(q[0])-1,int(q[1])):
        if w[i]==q[2]:
            w[i]=q[3]
for i in w:
    print(i,end='')


_, m = [int(x) for x in input().split()]

s = list(input())

for ii in range(m):
    args = input().split()
    l, r = int(args[0]), int(args[1])
    c1, c2 = args[2], args[3]

    for j in range(l - 1, r):
        if s[j] == c1:
            s[j] = c2

print(''.join(s))