#include<stdio.h>
int main()
{
    int m = 0, n = 0, l = 0, r = 0, i;
    char ch1, ch2;
    scanf("%d %d",&n,&m);
    char ch[50]={0};
    scanf("%s", &ch);
    for( i = 0; i < m; ++i )
    {
        int j = 0;
        scanf("%d %d %c %c", &l, &r, &ch1, &ch2);
        for( j = l - 1; j < r; j++ )
        {
            if( ch[j] == ch1 )
                ch[j] = ch2;
        }       
    }
   printf("%s",ch);
    return 0;
}