#include <bits/stdc++.h>
int main() {
  int n, m;
  std::cin >> n >> m;
  std::string s;
  std::cin >> s;
  int l, r;
  char c1, c2;
  for (size_t j = 0; j < m; j++) {
    std::cin >> l >> r >> c1 >> c2;
    l--;
    r--;
    for (size_t i = l; i <= r; i++) {
      if (s[i] == c1) {
        s[i] = c2;
      }
    }
  }
  std::cout << s << std::endl;
  return 0;
}
