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