#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[200002];
int aib[200002];
set<int> V[258];
void add(int i, int val) {
  for (; i <= n; i += i & (-i)) aib[i] += val;
}
int findPos(int l) {
  int i = 0, s = 0, p = 1 << 17;
  for (; p > 0; p >>= 1)
    if ((i + p <= n) && s + aib[i + p] < l) {
      i += p;
      s += aib[i];
    }
  return i + 1;
}
int sum(int i) {
  int s = 0;
  for (; i > 0; i -= i & (-i)) s += aib[i];
  return s;
}
int main() {
  scanf("%d%d\n", &n, &m);
  gets(a + 1);
  for (int i = 1; i <= n; ++i) {
    V[a[i]].insert(i);
    add(i, 1);
  }
  while (m--) {
    int l, r;
    char c;
    scanf("%d %d %c\n", &l, &r, &c);
    int L = findPos(l), R = findPos(r);
    auto beg = V[c].lower_bound(L), en = V[c].upper_bound(R);
    for (auto it = beg; it != V[c].end() && it != en; ++it) add(*it, -1);
    V[c].erase(beg, en);
  }
  int s = 0;
  for (int i = 1; i <= n; ++i)
    if (sum(i) != s) {
      printf("%c", a[i]);
      s = sum(i);
    }
  return 0;
}
