#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, from, to;
  string task;
  char f, t;
  cin >> n >> m >> task;
  while (m--) {
    cin >> from >> to >> f >> t;
    for (int i = from - 1; i <= to - 1; i++) {
      if (task[i] == f) {
        task[i] = t;
      }
    }
  }
  cout << task << endl;
}
