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