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