#include <bits/stdc++.h>
using namespace std;
char str[107];
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  int l, r;
  char ch1, ch2;
  cin >> n >> m;
  cin >> str;
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> ch1 >> ch2;
    for (int j = l - 1; j <= r - 1; j++)
      if (str[j] == ch1) str[j] = ch2;
  }
  cout << str << endl;
  return 0;
}
