#include <bits/stdc++.h>
using namespace std;
string f(string s, int l, int o, char c, char c1) {
  for (long long i = l; i < o + 1; i++) {
    if (s[i] == c1) s[i] = c;
  }
  return s;
}
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  while (m--) {
    int l1, l2;
    char c1, c2;
    cin >> l1 >> l2 >> c1 >> c2;
    s = f(s, l1 - 1, l2 - 1, c2, c1);
  }
  cout << s << endl;
}
