#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200000;
const int SIGMA = 62;
char str[1 + MAX_N];
bool nuexista[1 + MAX_N];
char getch(FILE *fin) {
  char ch = fgetc(fin);
  while (ch == ' ' || ch == '\n') ch = fgetc(fin);
  return ch;
}
int aib[1 + MAX_N];
static inline int lsb(int x) { return x & (-x); }
static inline void update(int p, int n, int v) {
  while (p <= n) {
    aib[p] += v;
    p += lsb(p);
  }
}
static inline int query(int p) {
  int r = 0;
  while (p > 0) {
    r += aib[p];
    p -= lsb(p);
  }
  return r;
}
static inline int getpoz(int x, int n) {
  int st = 0, dr = n;
  while (dr - st > 1) {
    int mid = (st + dr) / 2;
    if (query(mid) < x)
      st = mid;
    else
      dr = mid;
  }
  return dr;
}
set<int> poz[SIGMA];
int top;
int eraseset[MAX_N];
static inline char conv(char ch) {
  if ('0' <= ch && ch <= '9')
    return ch - '0';
  else if ('a' <= ch && ch <= 'z')
    return ch - 'a' + 10;
  else
    return ch - 'A' + 36;
}
int main() {
  int n, m, l, r;
  char ch;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    str[i] = getch(stdin);
    update(i, n, 1);
    poz[conv(str[i])].insert(i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &l, &r);
    ch = getch(stdin);
    l = getpoz(l, n);
    r = getpoz(r, n);
    set<int>::iterator it;
    it = poz[conv(ch)].lower_bound(l);
    while (it != poz[conv(ch)].end() && l <= *it && *it <= r) {
      nuexista[*it] = true;
      update(*it, n, -1);
      eraseset[top++] = *it;
      it++;
    }
    while (top > 0) {
      poz[conv(ch)].erase(eraseset[--top]);
    }
  }
  for (int i = 1; i <= n; ++i)
    if (!nuexista[i]) fputc(str[i], stdout);
  return 0;
}
