#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string str;
  cin >> str;
  while (m--) {
    int l, k;
    char a, b;
    cin >> l >> k >> a >> b;
    if (l < k) {
      for (int index = l - 1; index < k; index++) {
        if (str[index] == a) str[index] = b;
      }
    } else if (k == l) {
      if (str[k - 1] == a) str[k - 1] = b;
    } else if (l > k) {
      for (int index = k - 1; index < l; index++) {
        if (str[index] == a) str[index] = b;
      }
    }
  }
  cout << str;
  return 0;
}
