#include <bits/stdc++.h>
using namespace std;
int n;
int m;
string s;
int main() {
  scanf("%d %d", &n, &m);
  cin >> s;
  while (m--) {
    int l, r;
    char a, b;
    scanf("%d %d %c %c", &l, &r, &a, &b);
    l--;
    r--;
    for (int i = l; i <= r; ++i) {
      if (s[i] == a) {
        s[i] = b;
      }
    }
  }
  cout << s << endl;
  return 0;
}
