#include <bits/stdc++.h>
using namespace std;
const int SZ = 75;
const int inf = numeric_limits<int>::max();
set<int> ch[SZ];
struct nd {
  int k, p, cnt;
  nd *l, *r;
  nd(int k, int p) : k(k), p(p), l(NULL), r(NULL), cnt(1) {}
};
nd* root = NULL;
int get_cnt(nd* t) { return !t ? 0 : t->cnt; }
void upt_cnt(nd*& t) {
  if (t) t->cnt = get_cnt(t->l) + 1 + get_cnt(t->r);
}
void split(nd* t, int k, nd*& l, nd*& r) {
  if (!t)
    l = r = NULL;
  else if (k < t->k)
    split(t->l, k, l, t->l), r = t;
  else
    split(t->r, k, t->r, r), l = t;
  upt_cnt(t);
}
void ins(nd*& t, nd* nn) {
  if (!t)
    t = nn;
  else if (nn->p > t->p)
    split(t, nn->k, nn->l, nn->r), t = nn;
  else
    ins(nn->k < t->k ? t->l : t->r, nn);
  upt_cnt(t);
}
void merge(nd*& t, nd* l, nd* r) {
  if (!l || !r)
    t = l ? l : r;
  else if (l->p > r->p)
    merge(l->r, l->r, r), t = l;
  else
    merge(r->l, l, r->l), t = r;
  upt_cnt(t);
}
void del(nd*& t, int k) {
  if (t->k == k)
    merge(t, t->l, t->r);
  else
    del(k < t->k ? t->l : t->r, k);
  upt_cnt(t);
}
int find_p(nd* t, int x) {
  if (get_cnt(t->l) == x)
    return t->k;
  else if (get_cnt(t->l) > x)
    return find_p(t->l, x);
  else
    return find_p(t->r, x - get_cnt(t->l) - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  srand(time(NULL));
  int n, m, a, b;
  char c;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    cin >> c, ch[int(c) - 48].insert(i), ins(root, new nd(i, rand() % inf));
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    int idx = int(c) - 48, lo = find_p(root, a - 1), hi = find_p(root, b - 1);
    vector<int> cl;
    for (auto it = ch[idx].lower_bound(lo);
         it != ch[idx].end() && it != ch[idx].lower_bound(hi + 1); it++) {
      del(root, *it);
      cl.emplace_back(*it);
    }
    for (auto j : cl) ch[idx].erase(j);
  }
  set<pair<int, int> > r;
  for (int i = 0; i < 75; i++)
    for (auto it : ch[i]) r.insert({it, i + 48});
  for (auto it : r) cout << char(it.second);
  cout << endl;
}
