#include <bits/stdc++.h>
using namespace std;
int sqrtDecomposition[500];
int info[200005], blockSize, n;
set<int> s[80];
string ss, result;
vector<int> res;
void update(int p) {
  info[p]++;
  sqrtDecomposition[(p - 1) / blockSize + 1]++;
}
int getRest(int p) {
  int t = 0, i = 1;
  while (t + blockSize - sqrtDecomposition[i] < p) {
    t += (blockSize - sqrtDecomposition[i]);
    i++;
  }
  i = blockSize * (i - 1) + 1;
  if (t == p && info[i] == 0) {
    return i - 1;
  }
  while (1) {
    if (info[i] == 0) {
      t++;
    }
    if (t == p) {
      break;
    }
    i++;
  }
  return i;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m, a, b, i, j, l, r;
  char c;
  cin >> n >> m;
  cin >> ss;
  for (i = 0; i < ss.size(); i++) {
    s[ss[i] - '0'].insert(i + 1);
  }
  blockSize = sqrt(n);
  for (i = 0; i < m; i++) {
    cin >> l >> r >> c;
    l = getRest(l);
    r = getRest(r);
    auto it = s[c - '0'].lower_bound(l);
    while (it != s[c - '0'].end() && *it <= r) {
      update(*it);
      auto itt = it;
      it++;
      s[c - '0'].erase(itt);
    }
  }
  for (i = 0; i < 80; i++) {
    for (auto it : s[i]) {
      res.push_back(it);
    }
  }
  sort(res.begin(), res.end());
  result = "";
  for (auto it : res) {
    result += ss[it - 1];
  }
  cout << result;
  return 0;
}
