#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
string sum(string a, string b) {
  string ans = "";
  for (long long i = 0; i <= max((int((a.size()))), (int((b.size())))); i++)
    ans += '0';
  reverse((a).begin(), (a).end());
  reverse((b).begin(), (b).end());
  while ((int((a.size()))) > (int((b.size())))) b += '0';
  while ((int((a.size()))) < (int((b.size())))) a += '0';
  for (long long i = 0; i <= (int((a.size()))) - 1; i++) {
    int temp = int(ans[i] - '0');
    temp += (a[i] - '0');
    temp += (b[i] - '0');
    int j = 0;
    while (temp > 0) {
      ans[i + j] = char((temp % 10) + '0');
      temp /= 10;
      j++;
    }
  }
  reverse((ans).begin(), (ans).end());
  while (ans[0] == '0' && (int((ans.size()))) > 1) ans.erase(0, 1);
  return ans;
}
bool prime(long long x) {
  if (x == 0) return 1;
  if (x == 1) return 0;
  for (long long i = 2; i <= sqrt(x); i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
bool palindrom(string s) {
  string ss = "";
  for (long long i = 0; i <= s.size() - 1; i++) ss = s[i] + ss;
  return ss == s;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (!1) {
    freopen("INPUT.TXT", "r", stdin);
    freopen("OUTPUT.TXT", "w", stdout);
  }
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  for (long long i = 1; i <= m; i++) {
    int l, r;
    char a, b;
    cin >> l >> r >> a >> b;
    for (long long j = l - 1; j <= r - 1; j++) {
      if (s[j] == a) {
        s[j] = b;
      }
    }
  }
  cout << s;
  return 0;
}
