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