#include <bits/stdc++.h>
using namespace std;
const int mn = 100005;
char s[mn], t[5], c[5];
int nxt[mn][26], f[300][300][300];
int ss[4][mn];
int main() {
  int n, m;
  scanf("%d%d%s", &n, &m, s + 1);
  memset(nxt, 0x3f, sizeof nxt);
  for (int i = 0; i < 26; i++) nxt[n + 1][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 < n) nxt[i][s[i + 1] - 'a'] = i + 1;
  }
  int x = 0, y = 0, z = 0;
  while (m--) {
    int num;
    scanf("%s%d", t, &num);
    if (t[0] == '+') {
      scanf("%s", c);
      if (num == 1) {
        ss[1][++x] = c[0];
        for (int i = x; i <= x; i++)
          for (int j = 0; j <= y; j++)
            for (int k = 0; k <= z; k++) {
              if (i + j + k) f[i][j][k] = n + 1;
              if (i)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i - 1][j][k]][ss[1][i] - 'a']);
              if (j)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i][j - 1][k]][ss[2][j] - 'a']);
              if (k)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i][j][k - 1]][ss[3][k] - 'a']);
            }
      } else if (num == 2) {
        ss[2][++y] = c[0];
        for (int j = y; j <= y; j++)
          for (int i = 0; i <= x; i++)
            for (int k = 0; k <= z; k++) {
              if (i + j + k) f[i][j][k] = n + 1;
              if (i)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i - 1][j][k]][ss[1][i] - 'a']);
              if (j)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i][j - 1][k]][ss[2][j] - 'a']);
              if (k)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i][j][k - 1]][ss[3][k] - 'a']);
            }
      } else {
        ss[3][++z] = c[0];
        for (int k = z; k <= z; k++)
          for (int i = 0; i <= x; i++)
            for (int j = 0; j <= y; j++) {
              if (i + j + k) f[i][j][k] = n + 1;
              if (i)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i - 1][j][k]][ss[1][i] - 'a']);
              if (j)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i][j - 1][k]][ss[2][j] - 'a']);
              if (k)
                f[i][j][k] =
                    min(f[i][j][k], nxt[f[i][j][k - 1]][ss[3][k] - 'a']);
            }
      }
    } else {
      if (num == 1)
        --x;
      else if (num == 2)
        --y;
      else
        --z;
    }
    printf("%s\n", f[x][y][z] > n ? "NO" : "YES");
  }
}
