#include <bits/stdc++.h>
using namespace std;
const int N = 3010;
vector<int> prim;
bool vis[N];
char s[N];
int main() {
  int n, m;
  scanf("%d%d%s", &n, &m, s + 1);
  for (int i = 1; i <= m; i++) {
    int l, r;
    char c, d;
    scanf(" %d %d %c %c", &l, &r, &c, &d);
    for (int j = l; j <= r; j++)
      if (s[j] == c) {
        s[j] = d;
      }
  }
  cout << s + 1 << endl;
  return 0;
}
