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