#include <stdio.h> int main() { int n, m; scanf("%d %d", &n, &m); char list[n+1]; getchar(); for (int i = 0; i < n; i++) { scanf("%c", &list[i]); } int l, t; char c1, c2; for (int i = 0; i < m; i++) { scanf("%d %d", &l, &t); getchar(); scanf("%c", &c1); getchar(); scanf("%c", &c2); int j = 0; for (j = l - 1; j < t; j++) { if (list[j] == c1) { list[j] = c2; } } } for (int i = 0; i < n; i++) { if (list[i] != '\0') { printf("%c", list[i]); } } return 0; }