#include <bits/stdc++.h>
using namespace std;
int n, q, dp[270][270][270], go[220001][26];
char s[220001], t[5][301];
inline int getnext(int pos, char ch) {
  return pos > n ? 0x3f3f3f3f : go[pos][ch - 'a'];
}
int main() {
  scanf("%d%d%s", &n, &q, s + 1);
  memset(go, 0x3f, sizeof go);
  for (int i = n - 1; i >= 0; i--) {
    memcpy(go[i], go[i + 1], sizeof go[i]);
    go[i][s[i + 1] - 'a'] = i + 1;
  }
  memset(dp, 0x3f, sizeof dp);
  dp[0][0][0] = 0;
  int x = 0, y = 0, z = 0;
  while (q--) {
    char op[3], ch[3];
    int id;
    scanf("%s%d", op, &id);
    if (op[0] == '+') {
      scanf("%s", ch);
      if (id == 1) {
        t[1][++x] = ch[0];
        for (int i = 0; i <= y; i++)
          for (int j = 0; j <= z; j++)
            dp[x][i][j] =
                min(getnext(dp[x - 1][i][j], t[1][x]),
                    min(i ? getnext(dp[x][i - 1][j], t[2][i]) : 0x3f3f3f3f,
                        j ? getnext(dp[x][i][j - 1], t[3][j]) : 0x3f3f3f3f));
      } else if (id == 2) {
        t[2][++y] = ch[0];
        for (int i = 0; i <= x; i++)
          for (int j = 0; j <= z; j++)
            dp[i][y][j] =
                min(getnext(dp[i][y - 1][j], t[2][y]),
                    min(i ? getnext(dp[i - 1][y][j], t[1][i]) : 0x3f3f3f3f,
                        j ? getnext(dp[i][y][j - 1], t[3][j]) : 0x3f3f3f3f));
      } else {
        t[3][++z] = ch[0];
        for (int i = 0; i <= x; i++)
          for (int j = 0; j <= y; j++)
            dp[i][j][z] =
                min(getnext(dp[i][j][z - 1], t[3][z]),
                    min(i ? getnext(dp[i - 1][j][z], t[1][i]) : 0x3f3f3f3f,
                        j ? getnext(dp[i][j - 1][z], t[2][j]) : 0x3f3f3f3f));
      }
    } else if (id == 1)
      x--;
    else if (id == 2)
      y--;
    else
      z--;
    puts(dp[x][y][z] <= n ? "YES" : "NO");
  }
}
