#include <bits/stdc++.h>
using namespace std;
unsigned long long fastExp(unsigned long long x, unsigned long long y) {
  unsigned long long res = 1;
  while (y > 0) {
    if (y % 2 == 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long len, nquery, startIndex, endIndex;
  string word, c2;
  char c1;
  cin >> len >> nquery;
  cin >> word;
  for (int i = 1; i <= nquery; i++) {
    cin >> startIndex >> endIndex >> c1 >> c2;
    for (int j = startIndex - 1; j <= endIndex - 1; j++) {
      if (word[j] == c1) word.replace(j, 1, c2);
    }
  }
  cout << word << endl;
  return 0;
}
