#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 777;
string a;
int main() {
  int n;
  int m;
  cin >> n >> m;
  cin >> a;
  while (m--) {
    int l, r;
    cin >> l >> r;
    char x, y;
    cin >> x >> y;
    l--;
    r--;
    for (int i = l; i <= r; i++) {
      if (a[i] == x) {
        a[i] = y;
      }
    }
  }
  cout << a;
}
