#include <bits/stdc++.h>
using namespace std;
char a[105];
int c[105];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  getchar();
  gets(a);
  for (int i = 0; i < n; i++) {
    c[i] = a[i] - 'a';
  }
  int a, b;
  char x, y;
  int l, k;
  while (m--) {
    cin >> a >> b >> x >> y;
    for (int i = a - 1; i <= b - 1; i++) {
      int l = x - 'a';
      int k = y - 'a';
      if (c[i] == l) {
        c[i] = k;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%c", c[i] + 'a');
  }
  printf("\n");
}
