#include <bits/stdc++.h>
int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
using namespace std;
long long power(long long a, long long p, long long M) {
  long long r = 1;
  a = a % M;
  while (p > 0) {
    if (p % 2) r = (r * a) % M;
    a = (a * a) % M;
    p /= 2;
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long n, m;
  scanf("%lld%lld", &n, &m);
  string s;
  cin >> s;
  for (int i = 0; i < m; i++) {
    long long l, r;
    char c1, c2;
    scanf("%lld%lld", &l, &r);
    cin >> c1 >> c2;
    for (int j = l - 1; j < r; j++) {
      if (s[j] == c1) {
        s[j] = c2;
      }
    }
  }
  cout << s << endl;
}
int main() {
  solve();
  return 0;
}
