#include <bits/stdc++.h>
using namespace std;
int n, m, l, r;
char x[101], c, d;
int main() {
  cin >> n >> m >> x;
  while (m--) {
    cin >> l >> r >> c >> d;
    for (int i = l - 1; i < r; i++)
      if (x[i] == c) x[i] = d;
  }
  cout << x << "\n";
}
