#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s, p, k, m, t, x, y, ans, res;
  char b, c;
  string a;
  cin >> n >> t;
  cin >> a;
  while (t--) {
    cin >> x >> y >> b >> c;
    for (int i = x - 1; i < y; i++) {
      if (a[i] == b) a[i] = c;
    }
  }
  cout << a << endl;
  return 0;
}
