#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, j, k;
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, m;
  string s;
  cin >> n >> m >> s;
  for (i = 0; i < m; i++) {
    int a, b;
    char c, d;
    cin >> a >> b >> c >> d;
    a--;
    b--;
    for (j = a; j <= b; j++) {
      if (s[j] == c) s[j] = d;
    }
  }
  cout << s << endl;
  return 0;
}
