#include <bits/stdc++.h>
using namespace std;
vector<int> v[256];
char s[200];
int n, m;
int main() {
  cin >> n >> m;
  cin >> s;
  for (int i = 0; i < n; i++) {
    v[s[i]].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    char c1, c2;
    cin >> l >> r >> c1 >> c2;
    l--;
    r--;
    int k = v[c1].size();
    for (int j = 0; j < k; j++) {
      if (v[c1][j] >= l && v[c1][j] <= r) {
        s[v[c1][j]] = c2;
        v[c2].push_back(v[c1][j]);
        v[c1].erase(v[c1].begin() + j);
        j--;
        k--;
      }
    }
  }
  cout << s;
}
