#include <bits/stdc++.h>
using namespace std;
int n, m;
char ar[101];
int main() {
  scanf("%d %d\n", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%c", &ar[i]);
  }
  while (m--) {
    int a, b;
    char f, t;
    scanf("%d %d %c %c", &a, &b, &f, &t);
    for (int i = a; i <= b; i++) {
      if (ar[i] == f) ar[i] = t;
    }
  }
  for (int i = 1; i <= n; i++) printf("%c", ar[i]);
  printf("\n");
}
