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