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