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