抄作业,稍有改动

n,m =map(int,input().split())
str1 =[i for i in input()]
for i in range(m):
    l,r,ch1,ch2 = input().split()
    for j in range(int(l)-1,int(r)):
        if str1[j]==ch1:
            str1[j] = ch2
print("".join(str1))