#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long modexp(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    long long y = modexp(x, n / 2) % mod;
    return (y * y) % mod;
  }
  return (x * modexp(x, n - 1) % mod) % mod;
}
struct segtree {
  int sum;
} segtree[800005];
void cons(int low, int high, int pos) {
  if (low > high) return;
  if (low == high) {
    segtree[pos].sum = 1;
    return;
  }
  int mid = (low + high) / 2;
  cons(low, mid, 2 * pos + 1);
  cons(mid + 1, high, 2 * pos + 2);
  segtree[pos].sum = segtree[2 * pos + 1].sum + segtree[2 * pos + 2].sum;
}
void update(int qlow, int qhigh, int low, int high, int pos, int delta) {
  if (low > high) return;
  if (qlow > high || qhigh < low) return;
  if (low == high && low == qlow) {
    segtree[pos].sum = delta;
    return;
  }
  if (low == high) return;
  int mid = (low + high) / 2;
  update(qlow, qhigh, low, mid, 2 * pos + 1, delta);
  update(qlow, qhigh, mid + 1, high, 2 * pos + 2, delta);
  segtree[pos].sum = segtree[2 * pos + 1].sum + segtree[2 * pos + 2].sum;
}
int query(int qlow, int qhigh, int low, int high, int pos) {
  if (low > high || qlow > qhigh) return 0;
  if (qlow > high || qhigh < low) return 0;
  if (qlow <= low && qhigh >= high) return segtree[pos].sum;
  if (low == high) return 0;
  int mid = (low + high) / 2;
  return (query(qlow, qhigh, low, mid, 2 * pos + 1) +
          query(qlow, qhigh, mid + 1, high, 2 * pos + 2));
}
set<int> st[65];
int charmap(char x) {
  if (x >= 'a' && x <= 'z')
    return x - 'a';
  else if (x >= 'A' && x <= 'Z')
    return 26 + (x - 'A');
  else
    return 52 + (x - '0');
}
int solve(int low, int high, int n, int val) {
  while (low <= high) {
    int mid = (low + high) / 2;
    int suml = query(1, mid, 1, n, 1);
    if (suml > val)
      high = mid - 1;
    else if (suml < val)
      low = mid + 1;
    else {
      if (mid == 1)
        return mid;
      else if (query(1, mid - 1, 1, n, 1) == val)
        high = mid - 1;
      else
        return mid;
    }
  }
}
bool mark[200005];
int main() {
  string s, ch;
  int n, m, l, r;
  scanf("%d%d", &n, &m);
  cin >> s;
  s = '#' + s;
  for (int i = 1; i <= n; i++) {
    int k = charmap(s[i]);
    st[k].insert(i);
  }
  cons(1, n, 1);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &l, &r);
    cin >> ch;
    l = solve(1, n, n, l);
    r = solve(1, n, n, r);
    int j = charmap(ch[0]);
    if (st[j].size() == 0) continue;
    set<int>::iterator it = st[j].end();
    it--;
    if (*it < l) continue;
    it = st[j].lower_bound(l);
    vector<int> v;
    for (; it != st[j].end(); it++) {
      if ((*it) > r) break;
      update((*it), (*it), 1, n, 1, 0);
      mark[(*it)] = 1;
      v.push_back(*it);
    }
    for (int k = 0; k < v.size(); k++) st[j].erase(v[k]);
    v.clear();
  }
  string ans;
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) ans += s[i];
  }
  cout << ans << endl;
  return 0;
}
