#include <bits/stdc++.h>
int main() {
  int n, m;
  char s[110];
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  while (m--) {
    int a, b;
    char ch, ch1;
    scanf("%d%d %c %c", &a, &b, &ch, &ch1);
    for (int i = a; i <= b; i++) {
      if (s[i] == ch) s[i] = ch1;
    }
  }
  puts(s + 1);
  return 0;
}
