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