#include <bits/stdc++.h>
using namespace std;
int n, q;
char s[500];
int main() {
  cin >> n >> q >> (s + 1);
  while (q--) {
    int l, r;
    char ch1, ch2;
    cin >> l >> r >> ch1 >> ch2;
    for (int i = l; i <= r; i++)
      if (s[i] == ch1) s[i] = ch2;
  }
  cout << (s + 1) << '\n';
  return 0;
}
