#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
template <typename T>
static T aabs(T x) {
  if (x < 0) return -x;
  return x;
}
template <typename T>
static void read(T &S) {
  char K[1000009];
  scanf("%s", &K);
  S = K;
}
template <typename T, typename U>
static void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
static void amin(T &x, U y) {
  if (x > y) x = y;
}
template <typename T, typename U>
static void aswap(T &x, U &y) {
  T temp;
  temp = x;
  x = y;
  y = temp;
}
template <typename T, typename U>
static long long gcd(T a, U b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <typename T, typename U>
static long long lcm(T a, U b) {
  return a / gcd(a, b) * b;
}
template <typename T, typename U>
static long long fpow(T n, U k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
const int N5 = 100009;
const int N6 = 1000009;
int st[2 * N5 * 4];
string s;
set<int> mst[200];
void build(int id, int l, int r) {
  if (l == r) {
    st[id] = 1;
    return;
  }
  int mid = (l + r) / 2;
  build(id * 2, l, mid);
  build(id * 2 + 1, mid + 1, r);
  st[id] = st[id * 2] + st[id * 2 + 1];
}
void update(int id, int l, int r, int pos, int value) {
  if (r < pos || l > pos) return;
  if (l == r) {
    st[id] = value;
    return;
  }
  int mid = (l + r) / 2;
  update(id * 2, l, mid, pos, value);
  update(id * 2 + 1, mid + 1, r, pos, value);
  st[id] = st[id * 2] + st[id * 2 + 1];
}
int query(int id, int l, int r, int pos) {
  if (l == r) return l;
  int mid;
  mid = (l + r) / 2;
  if (pos > st[id * 2])
    query(id * 2 + 1, mid + 1, r, pos - st[id * 2]);
  else
    query(id * 2, l, mid, pos);
}
void finish(int id, int l, int r) {
  if (l == r) {
    if (st[id]) printf("%c", s[l]);
    return;
  }
  int mid;
  mid = (l + r) / 2;
  finish(id * 2, l, mid);
  finish(id * 2 + 1, mid + 1, r);
}
int conv(char c) {
  if (c >= 'a' && c <= 'z') return c - 'a';
  if (c >= 'A' && c <= 'z') return c - 'A' + 27;
  return c - '0' + 55;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  string ss;
  read(ss);
  s = " " + ss;
  for (int i = 1; i <= n; i++) mst[conv(s[i])].insert(i);
  for (int i = 0; i <= 100; i++) mst[i].insert(n + 1);
  build(1, 1, n);
  while (q--) {
    int l, r;
    string re;
    char ch;
    scanf("%d%d", &l, &r);
    read(re);
    ch = re[0];
    l = query(1, 1, n, l);
    r = query(1, 1, n, r);
    set<int>::iterator it, ait;
    it = mst[conv(ch)].lower_bound(l);
    while (*it <= r) {
      update(1, 1, n, *it, 0);
      ait = it;
      ++it;
      mst[conv(ch)].erase(ait);
    }
  }
  finish(1, 1, n);
  return 0;
  return 0;
}
