#include <bits/stdc++.h>
using namespace std;
static const int maxn = 2e5 + 5;
int tree[maxn];
int N;
inline void update(int pos, int val) {
  while (pos <= N) {
    tree[pos] += val;
    pos += (pos & -pos);
  }
}
inline int query(int pos) {
  int sum = 0;
  while (pos > 0) {
    sum += tree[pos];
    pos -= (pos & -pos);
  }
  return sum;
}
inline int getIndex(int index) {
  int low = 1;
  int high = N;
  int ans = -1;
  while (low <= high) {
    int mid = (low + high) >> 1;
    int sum = query(mid);
    if (sum == index)
      ans = mid, high = mid - 1;
    else if (sum < index)
      low = mid + 1;
    else
      high = mid - 1;
  }
  return ans;
}
vector<int> occ[200];
inline void doOperation(int l, int r, int id) {
  int newl = getIndex(l);
  int newr = getIndex(r);
  auto it = lower_bound(occ[id].begin(), occ[id].end(), newl);
  vector<int> del;
  for (; it != occ[id].end(); it++) {
    if (*it > newr) break;
    del.emplace_back(*it);
    update(*it, -1);
  }
  for (int d : del)
    occ[id].erase(lower_bound(occ[id].begin(), occ[id].end(), d));
}
int main() {
  int len, q;
  string s;
  cin >> len >> q >> s;
  N = len + 1;
  for (int i = 0; i < len; i++) {
    occ[s[i] - '0'].emplace_back(i + 1);
    update(i + 1, 1);
  }
  while (q--) {
    int l, r;
    char ch;
    cin >> l >> r >> ch;
    doOperation(l, r, ch - '0');
  }
  vector<int> ans;
  for (int i = 0; i < 200; i++)
    for (int id : occ[i]) ans.emplace_back(id);
  sort(ans.begin(), ans.end());
  for (int id : ans) cout << s[id - 1];
}
