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