#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  for (int i = (1); i <= (m); ++i) {
    int l, r;
    char a, b;
    cin >> l >> r >> a >> b;
    for (int i = (l - 1); i <= (r - 1); ++i)
      if (s[i] == a) s[i] = b;
  }
  cout << s << '\n';
  return 0;
}
