#include <bits/stdc++.h>
using namespace std;
int n, m, r, l, i;
char c1, c2;
string s;
int main() {
  cin >> n;
  for (cin >> m >> s; i < m; i++) {
    cin >> l >> r >> c1 >> c2;
    replace(s.begin() + l - 1, s.begin() + r, c1, c2);
  }
  cout << s << endl;
  return 0;
}
