#include <bits/stdc++.h>
using namespace std;
set<int> pos[1009];
int N, K, neutral = 0;
int comp(int a, int b) { return a + b; }
class SegmentTree {
  vector<int> a;
  int n;

 public:
  SegmentTree() {
    n = N;
    a.assign(n << 1, neutral);
  }
  void update(int i, int x) {
    a[i + n] = x;
    for (i += n, i >>= 1; i; i >>= 1) a[i] = comp(a[i << 1], a[1 + (i << 1)]);
  }
  int query(int l, int r) {
    int ans = neutral;
    for (l += n, r += n + 1; l < r; l >>= 1, r >>= 1) {
      if (l & 1) ans = comp(ans, a[l++]);
      if (r & 1) ans = comp(ans, a[--r]);
    }
    return ans;
  }
};
int bs(SegmentTree &st, int lt, int rt) {
  int l = 0, r = N - 1;
  while (l != r) {
    int mid = (l + r) / 2;
    int pos = mid - st.query(0, mid);
    if (pos < lt)
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
int bs2(SegmentTree &st, int lt, int rt) {
  int l = 0, r = N - 1;
  while (l != r) {
    int mid = (l + r + 1) / 2;
    int pos = mid - st.query(0, mid);
    if (pos > rt)
      r = mid - 1;
    else
      l = mid;
  }
  return l;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  char c;
  cin >> N >> K >> s;
  for (int i = 0; i < N; ++i) {
    pos[s[i]].insert(i);
  }
  int l, r;
  SegmentTree st;
  while (K--) {
    cin >> l >> r >> c;
    l--, r--;
    set<int> &aux = pos[c];
    int j = bs(st, l, r);
    int j2 = bs2(st, l, r);
    for (auto it = aux.lower_bound(j); it != aux.end();) {
      int k = *it;
      if (k > j2) break;
      st.update(k, 1);
      auto it2 = it;
      it++;
      aux.erase(it2);
    }
  }
  for (int i = 0; i < N; ++i) {
    if (st.query(i, i) != 1) cout << s[i];
  }
  cout << '\n';
}
