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