#include <stdio.h>

#include <string.h>

int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    char s[101]; // 字符串长度不超过100,所以数组大小设为101(包含'\0')
    scanf("%s", s);

    for (int i = 0; i < m; i++) {
        int l, r;
        char c1, c2;
        scanf("%d %d %c %c", &l, &r, &c1, &c2);

        // 注意:题目中区间是1-based,转换为字符串的0-based索引
        for (int j = l - 1; j <= r - 1; j++) {
            if (s[j] == c1) {
                s[j] = c2;
            }
        }
    }

    printf("%s\n", s);
    return 0;
}