#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, m;
  cin >> n >> m;
  char a, b;
  int flag1, flag2;
  cin >> s;
  for (int i = 0; i < m; i++) {
    cin >> flag1 >> flag2 >> a >> b;
    for (int j = flag1 - 1; j <= flag2 - 1; j++) {
      if (s[j] == a) {
        s[j] = b;
      }
    }
  }
  cout << s << endl;
}
