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