#include <bits/stdc++.h>
using namespace std;
int n;
int C[200005];
int lower_bit(int x) { return x & (-x); }
void add(int x, int y) {
  for (int i = x; i <= n; i += lower_bit(i)) C[i] += y;
}
int getpre(int x) {
  int ans = 0;
  for (int i = x; i > 0; i -= lower_bit(i)) ans += C[i];
  return ans;
}
int getsum(int x, int y) {
  if (x == 1)
    return getpre(y);
  else
    return getpre(y) - getpre(x - 1);
}
void build() {
  for (int i = 1; i <= n; i++) add(i, 1);
}
int findpos(int x) {
  int l = 1;
  int r = n;
  int mid = (l + r) / 2;
  while (l <= r) {
    mid = (l + r) / 2;
    if (getpre(mid) < x) {
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return l;
}
set<int> ss[80];
char str[200005];
int ans[200005];
int main() {
  int m;
  scanf("%d%d", &n, &m);
  scanf("%s", str);
  int len = strlen(str);
  for (int i = 0; i < len; i++) {
    ss[str[i] - '0'].insert(i + 1);
  }
  build();
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i < m; i++) {
    int l, r;
    char c;
    scanf("%d%d %c", &l, &r, &c);
    l = findpos(l);
    r = findpos(r);
    int cc = c - '0';
    set<int>::iterator it;
    it = lower_bound(ss[cc].begin(), ss[cc].end(), l);
    while (it != ss[cc].end() && (*it) <= r) {
      int v = *it;
      add(v, -1);
      ss[cc].erase(it++);
    }
  }
  for (int i = 0; i < 80; i++) {
    for (set<int>::iterator it = ss[i].begin(); it != ss[i].end(); ++it)
      ans[*it] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] != -1) putchar('0' + ans[i]);
  }
  return 0;
}
