#include <bits/stdc++.h>
using namespace std;
const int maxn = 10 + 200000;
int N, m;
char str[maxn];
int l, r;
char c;
map<char, set<int> > p;
int lowbit(int i) { return i & (-i); }
struct BITree {
  int BIT[maxn];
  void init() {
    memset(BIT, 0, sizeof(BIT));
    ;
    for (int i = 1; i <= N; i++) {
      for (int j = i; j > i - lowbit(i); j--) BIT[i] += 1;
    }
  }
  int query(int x) {
    int ans = 0;
    for (; x > 0; x -= lowbit(x)) ans += BIT[x];
    return ans;
  }
  int lower_bound(int v) {
    int x = 0, sum = 0;
    for (int i = (1 << 17); i; i >>= 1) {
      if (i + x <= N && sum + BIT[i + x] < v) {
        x += i;
        sum += BIT[x];
      }
    }
    return x + 1;
  }
  void update(int i, int val) {
    for (; i <= N; i += lowbit(i)) BIT[i] += val;
  }
} bit;
void read() {
  scanf("%d %d", &N, &m);
  scanf("%s", str + 1);
}
int main() {
  p.clear();
  read();
  for (int i = 1; i <= N; i++) {
    p[str[i]].insert(i);
  }
  bit.init();
  for (int j = 0; j < (m); j++) {
    scanf("%d %d %c", &l, &r, &c);
    r = bit.lower_bound(r);
    l = bit.lower_bound(l);
    for (auto mover = p[c].lower_bound(l);
         mover != p[c].end() && *mover <= r;) {
      bit.update(*mover, -1);
      p[c].erase(mover++);
    }
  }
  for (int i = 1; i <= N; i++) {
    if (p[str[i]].find(i) != p[str[i]].end()) printf("%c", (str[i]));
  }
}
