#include <bits/stdc++.h>
using namespace std;
template <class U>
inline void smin(U &a, const U &b) {
  if (a > b) a = b;
}
const int inf = 0x3f3f3f3f;
const int NN = 1e5 + 10;
char s[NN];
char a[4][255];
int b[4];
int nxt[NN][26];
int pos[256][256][256];
int main() {
  int n, id, test;
  scanf("%d %d", &n, &test);
  scanf("%s", s + 1);
  for (int i = 'a'; i <= 'z'; i++) {
    int ed = inf;
    for (int j = n; j >= 0; j--) {
      nxt[j][i - 'a'] = ed;
      if (s[j] == i) ed = j;
    }
  }
  char c;
  while (test--) {
    scanf(" %c %d", &c, &id);
    id--;
    if (c == '-')
      b[id]--;
    else {
      scanf(" %c", &c);
      c -= 'a';
      a[id][++b[id]] = c;
      if (id == 0) {
        for (int i = 0; i <= b[1]; i++)
          for (int j = 0; j <= b[2]; j++) pos[b[0]][i][j] = inf;
        for (int i = 0; i <= b[1]; i++)
          for (int j = 0; j <= b[2]; j++) {
            if (pos[b[0] - 1][i][j] <= n)
              smin(pos[b[0]][i][j], nxt[pos[b[0] - 1][i][j]][c]);
            if (i && pos[b[0]][i - 1][j] <= n)
              smin(pos[b[0]][i][j], nxt[pos[b[0]][i - 1][j]][a[1][i]]);
            if (j && pos[b[0]][i][j - 1] <= n)
              smin(pos[b[0]][i][j], nxt[pos[b[0]][i][j - 1]][a[2][j]]);
          }
      } else if (id == 1) {
        for (int i = 0; i <= b[0]; i++)
          for (int j = 0; j <= b[2]; j++) pos[i][b[1]][j] = inf;
        for (int i = 0; i <= b[0]; i++)
          for (int j = 0; j <= b[2]; j++) {
            if (pos[i][b[1] - 1][j] <= n)
              smin(pos[i][b[1]][j], nxt[pos[i][b[1] - 1][j]][c]);
            if (i && pos[i - 1][b[1]][j] <= n)
              smin(pos[i][b[1]][j], nxt[pos[i - 1][b[1]][j]][a[0][i]]);
            if (j && pos[i][b[1]][j - 1] <= n)
              smin(pos[i][b[1]][j], nxt[pos[i][b[1]][j - 1]][a[2][j]]);
          }
      } else {
        for (int i = 0; i <= b[0]; i++)
          for (int j = 0; j <= b[1]; j++) pos[i][j][b[2]] = inf;
        for (int i = 0; i <= b[0]; i++)
          for (int j = 0; j <= b[1]; j++) {
            if (pos[i][j][b[2] - 1] <= n)
              smin(pos[i][j][b[2]], nxt[pos[i][j][b[2] - 1]][c]);
            if (i && pos[i - 1][j][b[2]] <= n)
              smin(pos[i][j][b[2]], nxt[pos[i - 1][j][b[2]]][a[0][i]]);
            if (j && pos[i][j - 1][b[2]] <= n)
              smin(pos[i][j][b[2]], nxt[pos[i][j - 1][b[2]]][a[1][j]]);
          }
      }
    }
    if (pos[b[0]][b[1]][b[2]] <= n)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
