#include <bits/stdc++.h>
inline long long int getint() {
  long long int _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
using namespace std;
int n, m;
char str[200];
int main() {
  n = getint();
  m = getint();
  scanf("%s", str);
  while (m--) {
    int l = getint() - 1;
    int r = getint() - 1;
    char c1 = getchar();
    getchar();
    char c2 = getchar();
    for (int i = l; i <= r; ++i) {
      if (str[i] == c1) str[i] = c2;
    }
  }
  printf("%s\n", str);
  return 0;
}
