#include <bits/stdc++.h>
const int MAXN = 1000000, MAXM = 260;
using namespace std;
int n, m, a, b, c;
int f[MAXM][MAXM][MAXM], nxt[MAXN][26], A[MAXN], B[MAXN], C[MAXN];
char s[MAXN];
inline void init() {
  scanf("%d %d", &n, &m);
  scanf("%s", s + 1);
  for (int i = 0; i < 26; i++) nxt[n + 1][i] = nxt[n + 2][i] = n + 1;
  for (int i = n; i >= 0; i--) {
    for (int j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
    if (i) nxt[i][s[i] - 'a'] = i;
  }
}
int main() {
  init();
  int x;
  char opt[5];
  while (m--) {
    scanf("%s", opt);
    if (opt[0] == '+') {
      scanf("%d", &x);
      scanf("%s", opt);
      if (x == 1) {
        A[++a] = opt[0] - 'a';
        for (int i = 0; i <= b; i++)
          for (int j = 0; j <= c; j++) {
            f[a][i][j] = nxt[f[a - 1][i][j] + 1][A[a]];
            if (i) f[a][i][j] = min(f[a][i][j], nxt[f[a][i - 1][j] + 1][B[i]]);
            if (j) f[a][i][j] = min(f[a][i][j], nxt[f[a][i][j - 1] + 1][C[j]]);
          }
      }
      if (x == 2) {
        B[++b] = opt[0] - 'a';
        for (int i = 0; i <= a; i++)
          for (int j = 0; j <= c; j++) {
            f[i][b][j] = nxt[f[i][b - 1][j] + 1][B[b]];
            if (i) f[i][b][j] = min(f[i][b][j], nxt[f[i - 1][b][j] + 1][A[i]]);
            if (j) f[i][b][j] = min(f[i][b][j], nxt[f[i][b][j - 1] + 1][C[j]]);
          }
      }
      if (x == 3) {
        C[++c] = opt[0] - 'a';
        for (int i = 0; i <= a; i++)
          for (int j = 0; j <= b; j++) {
            f[i][j][c] = nxt[f[i][j][c - 1] + 1][C[c]];
            if (i) f[i][j][c] = min(f[i][j][c], nxt[f[i - 1][j][c] + 1][A[i]]);
            if (j) f[i][j][c] = min(f[i][j][c], nxt[f[i][j - 1][c] + 1][B[j]]);
          }
      }
      if (f[a][b][c] <= n)
        printf("YES\n");
      else
        printf("NO\n");
    } else {
      scanf("%d", &x);
      if (x == 1) a--;
      if (x == 2) b--;
      if (x == 3) c--;
      if (f[a][b][c] <= n)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
  return 0;
}
