#include <bits/stdc++.h>
using namespace std;
int main() {
  int tam, op, i, j, l, r;
  char s, novo;
  cin >> tam >> op;
  string word;
  cin >> word;
  for (i = 0; i < op; i++) {
    cin >> l >> r >> s >> novo;
    l--, r--;
    for (j = l; j <= r; j++) {
      if (word[j] == s) word[j] = novo;
    }
  }
  cout << word << endl;
  return 0;
}
