#include <bits/stdc++.h>
const int N = 100050;
const int T = 255;
int readInt() {
  int ans = 0, c, f = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') f *= -1;
  do ans = ans * 10 + c - '0';
  while (isdigit(c = getchar()));
  return ans * f;
}
char s[N], op[2];
char p1[N], p2[N], p3[N];
int n, q, nxt[N][26], F[T][T][T], n1, n2, n3;
inline void dp(int a, int b, int c) {
  int xa = a > 0 ? nxt[F[a - 1][b][c]][p1[a - 1] - 'a'] : n + 1;
  int xb = b > 0 ? nxt[F[a][b - 1][c]][p2[b - 1] - 'a'] : n + 1;
  int xc = c > 0 ? nxt[F[a][b][c - 1]][p3[c - 1] - 'a'] : n + 1;
  F[a][b][c] = std::min(xa, std::min(xb, xc));
}
int main() {
  n = readInt();
  q = readInt();
  scanf("%s", s);
  for (int i = 0; i < 26; ++i) nxt[n][i] = nxt[n + 1][i] = n + 1;
  for (int i = n - 1; i >= 0; --i) {
    memcpy(nxt[i], nxt[i + 1], sizeof nxt[i + 1]);
    nxt[i][s[i] - 'a'] = i + 1;
  }
  F[0][0][0] = 0;
  while (q--) {
    int o;
    scanf("%s%d", op, &o);
    if (*op == '-')
      --(o == 1 ? n1 : o == 2 ? n2 : n3);
    else if (o == 1) {
      scanf("%s", p1 + (n1++));
      for (int j = 0; j <= n2; ++j)
        for (int k = 0; k <= n3; ++k) dp(n1, j, k);
    } else if (o == 2) {
      scanf("%s", p2 + (n2++));
      for (int i = 0; i <= n1; ++i)
        for (int k = 0; k <= n3; ++k) dp(i, n2, k);
    } else {
      scanf("%s", p3 + (n3++));
      for (int i = 0; i <= n1; ++i)
        for (int j = 0; j <= n2; ++j) dp(i, j, n3);
    }
    puts(F[n1][n2][n3] <= n ? "YES" : "NO");
  }
}
