#include <bits/stdc++.h>
using namespace std;
long long n, m;
string ch;
void func(int l, int r, char c1, char c2) {
  while (l <= r) {
    if (ch[l] == c1) {
      ch[l] = c2;
    }
    l++;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> ch;
  while (m--) {
    int l, r;
    char c1, c2;
    cin >> l >> r >> c1 >> c2;
    l--, r--;
    func(l, r, c1, c2);
  }
  cout << ch;
  return 0;
}
