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