#include <bits/stdc++.h>
using namespace std;
inline int readChar();
template <class T = int>
inline T readInt();
template <class T>
inline void writeInt(T x, char end = 0);
inline void writeChar(int x);
inline void writeWord(const char *s);
struct BIT {
  vector<int> fen;
  BIT(int n) { fen.resize(n + 1); }
  void update(int no, int val) {
    no++;
    while (no < ((int)(fen).size())) {
      fen[no] += val;
      no += no & (-no);
    }
  }
  int query(int pos) {
    pos++;
    int ans = 0;
    while (pos > 0) {
      ans += fen[pos];
      pos -= pos & (-pos);
    }
    return ans;
  }
};
const int MAX = 200010;
int n, q;
char s[MAX];
set<int> simu[256];
int go(int val, BIT &bit) {
  int lo = 0, hi = n - 1, ans = -1;
  while (hi >= lo) {
    int mid = (hi + lo) >> 1;
    if (bit.query(mid) < val) {
      lo = mid + 1;
    } else {
      hi = mid - 1;
      ans = mid;
    }
  }
  return ans;
}
int main() {
  n = readInt();
  q = readInt();
  for (int(i) = 0; (i) < (n); (i)++) s[i] = readChar();
  BIT bit(n);
  for (int(i) = 0; (i) < (n); (i)++) bit.update(i, 1);
  for (int(i) = 0; (i) < (n); (i)++) simu[s[i]].insert(i);
  for (int(i) = 0; (i) < (q); (i)++) {
    int l = readInt(), r = readInt();
    char c = readChar();
    l = go(l, bit);
    r = go(r, bit);
    while (1) {
      auto it = simu[c].lower_bound(l);
      if (it == simu[c].end() || (*it) > r) break;
      bit.update(*it, -1);
      simu[c].erase(it);
    }
  }
  for (int(i) = 0; (i) < (n); (i)++)
    if (bit.query(i) - bit.query(i - 1)) writeChar(s[i]);
  writeChar('\n');
}
static const int buf_size = 4096;
inline int getChar() {
  static char buf[buf_size];
  static int len = 0, pos = 0;
  if (pos == len) pos = 0, len = fread(buf, 1, buf_size, stdin);
  if (pos == len) return -1;
  return buf[pos++];
}
inline int readChar() {
  int c = getChar();
  while (c <= 32) c = getChar();
  return c;
}
template <class T>
inline T readInt() {
  int s = 1, c = readChar();
  T x = 0;
  if (c == '-') s = -1, c = getChar();
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar();
  return s == 1 ? x : -x;
}
static int write_pos = 0;
static char write_buf[buf_size];
inline void writeChar(int x) {
  if (write_pos == buf_size)
    fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
  write_buf[write_pos++] = x;
}
template <class T>
inline void writeInt(T x, char end) {
  if (x < 0) writeChar('-'), x = -x;
  char s[24];
  int n = 0;
  while (x || !n) s[n++] = '0' + x % 10, x /= 10;
  while (n--) writeChar(s[n]);
  if (end) writeChar(end);
}
inline void writeWord(const char *s) {
  while (*s) writeChar(*s++);
}
struct Flusher {
  ~Flusher() {
    if (write_pos) fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
  }
} flusher;
