#include <bits/stdc++.h>
using namespace std;
const int ONE = 100005;
int get() {
  int res = 1, Q = 1;
  char c;
  while ((c = getchar()) < 48 || c > 57)
    if (c == '-') Q = -1;
  if (Q) res = c - 48;
  while ((c = getchar()) >= 48 && c <= 57) res = res * 10 + c - 48;
  return res * Q;
}
int n, m;
int l, r;
char s[ONE], c1, c2;
int main() {
  n = get();
  m = get();
  scanf("%s", s + 1);
  while (m--) {
    scanf("%d %d %c %c", &l, &r, &c1, &c2);
    for (int i = l; i <= r; i++)
      if (s[i] == c1) s[i] = c2;
  }
  int len = strlen(s + 1);
  for (int i = 1; i <= len; i++) cout << s[i];
}
