#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")
using namespace std;
const int MAXN = 200001;
int t[MAXN];
set<int> a[128];
inline void add(int i, int d) {
  for (; i < MAXN; i += i & -i) t[i] += d;
}
int lastLess(int s) {
  int k = 0, l = 20;
  while (--l >= 0)
    if (k + (1 << l) < MAXN && t[k + (1 << l)] < s) s -= t[k += (1 << l)];
  return k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    char c;
    cin >> c;
    a[c].insert(i);
    add(i, 1);
  }
  while (m--) {
    int l, r;
    char c;
    cin >> l >> r >> c;
    auto it1 = a[c].lower_bound(lastLess(l) + 1),
         it2 = a[c].upper_bound(lastLess(r) + 1);
    while (it1 != it2) {
      add(*it1, -1);
      a[c].erase(*it1++);
    }
  }
  vector<pair<int, char> > ans;
  for (int i = 0; i < 128; ++i)
    if (!a[i].empty())
      for (int j : a[i]) ans.push_back({j, (char)i});
  sort(ans.begin(), ans.end());
  for (pair<int, char> i : ans) cout << (char)i.second;
  return 0;
}
