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