#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, l, i, r;
  char c1, c2;
  string a;
  cin >> n >> m >> a;
  i = 0;
  while (i < m) {
    cin >> l >> r >> c1 >> c2;
    for (int p = l - 1; p < r; ++p) {
      if (a[p] == c1) {
        a[p] = c2;
      }
    }
    i++;
  }
  cout << a;
  return 0;
}
