#include <bits/stdc++.h>
using namespace std;
const long long NN = 211111;
const long long ML = 2147483647;
const long long MLL = 9223372036854775807;
const long double pi = acos(-1);
long long a[NN], n, m, i, k, j, f, l, r, e, x, y, z, w, ii, res, t[4 * NN + 1];
string S;
vector<long long> v;
set<long long> s[555];
char c;
set<long long>::iterator it;
template <typename T>
void stop(T s) {
  cout << s << "\n";
  exit(0);
}
void modify(int v, int tl, int tr, int pos, int val) {
  if (tl == tr)
    t[v] = val;
  else {
    int c = (tl + tr) >> 1;
    if (pos <= c)
      modify(v * 2, tl, c, pos, val);
    else
      modify(v * 2 + 1, c + 1, tr, pos, val);
    t[v] = t[v * 2] + t[v * 2 + 1];
  }
}
int get(int v, int tl, int tr, int k) {
  if (tl == tr) return tl;
  int c = (tl + tr) >> 1;
  if (t[v * 2] >= k)
    get(v * 2, tl, c, k);
  else
    get(v * 2 + 1, c + 1, tr, k - t[v * 2]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  S = "#";
  for (i = 1; i <= n; i++) {
    cin >> c;
    s[c].insert(i);
    modify(1, 1, n, i, 1);
    a[i] = 1;
    S += c;
  }
  for (i = 1; i <= m; i++) {
    cin >> l >> r >> c;
    v.clear();
    l = get(1, 1, n, l);
    r = get(1, 1, n, r);
    for (it = s[c].lower_bound(l); it != s[c].end(); it++) {
      ii = *it;
      if (ii > r) break;
      if (l <= ii && ii <= r) v.push_back(ii);
    }
    for (j = 0; j < v.size(); j++) {
      modify(1, 1, n, v[j], 0);
      a[v[j]] = 0;
      s[c].erase(v[j]);
    }
  }
  for (i = 1; i < S.size(); i++)
    if (a[i]) cout << S[i];
  cout << "\n";
  return 0;
}
