#include <bits/stdc++.h>
using namespace std;
class TaskA {
 public:
  string s;
  void process(int l, int r, char c1, char c2) {
    for (int i = l - 1; i <= r - 1; ++i) {
      if (s[i] == c1) {
        s[i] = c2;
      }
    }
  }
  void solve(std::istream& in, std::ostream& out) {
    int n, m;
    in >> n >> m;
    in >> s;
    for (int i = 0; i < m; ++i) {
      int l, r;
      char c1, c2;
      in >> l >> r >> c1 >> c2;
      process(l, r, c1, c2);
    }
    out << s;
  }
};
int main() {
  TaskA solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
