#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 q, p;
    cin >> q >> p;
    string a;
    string b;
    cin >> a >> b;
    for (int j = q - 1; j <= p - 1; j++) {
      if (s[j] == a[0]) {
        s[j] = b[0];
      }
    }
  }
  cout << s << endl;
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  getchar();
  return 0;
}
