#include <bits/stdc++.h>
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
const int MOD = mod - 1;
const double eps = 1e-18;
const double PI = acos(-1.0);
using namespace std;
char s[200];
int main() {
  int n, m;
  scanf("%d", &n), scanf("%d", &m);
  scanf("%s", s + 1);
  int l = strlen(s + 1);
  while (m--) {
    int l, r;
    char a, b;
    scanf("%d %d %c %c", &l, &r, &a, &b);
    getchar();
    for (int i = l; i <= r; i++)
      if (s[i] == a) s[i] = b;
  }
  puts(s + 1);
}
