#include <bits/stdc++.h>
using namespace std;
int main() {
  int length;
  cin >> length;
  int query;
  cin >> query;
  string result;
  cin >> result;
  for (int i = 0; i < query; ++i) {
    int left;
    int right;
    cin >> left >> right;
    char which;
    char what;
    cin >> which >> what;
    for (int j = left; j <= right; ++j)
      if (result[j - 1] == which) result[j - 1] = what;
  }
  cout << result;
}
