#include <bits/stdc++.h>
int main() {
  int n, m, l, r;
  scanf("%d %d", &n, &m);
  char a[n + 1];
  scanf("%s", a);
  char c1, c2;
  int i;
  for (i = 0; i < m; i++) {
    scanf("%d %d %c %c", &l, &r, &c1, &c2);
    for (int j = l - 1; j < r; j++) {
      if (a[j] == c1) {
        a[j] = c2;
      }
    }
  }
  printf("%s", a);
  return 0;
}
