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