#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int INF = 0x3f3f3f3f;
char s[maxn], t[4][255];
int dp[255][255][255], len[4];
int nxt[maxn][26];
void update(int id) {
  for (int i = id == 1 ? len[1] : 0; i <= len[1]; ++i) {
    for (int j = id == 2 ? len[2] : 0; j <= len[2]; ++j) {
      for (int k = id == 3 ? len[3] : 0; k <= len[3]; ++k) {
        dp[i][j][k] = INF;
        if (i && dp[i - 1][j][k] != INF)
          dp[i][j][k] =
              min(dp[i][j][k], nxt[dp[i - 1][j][k] + 1][t[1][i] - 'a']);
        if (j && dp[i][j - 1][k] != INF)
          dp[i][j][k] =
              min(dp[i][j][k], nxt[dp[i][j - 1][k] + 1][t[2][j] - 'a']);
        if (k && dp[i][j][k - 1] != INF)
          dp[i][j][k] =
              min(dp[i][j][k], nxt[dp[i][j][k - 1] + 1][t[3][k] - 'a']);
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  scanf("%s", s + 1);
  for (int i = 0; i < 26; ++i) {
    nxt[n + 1][i] = INF;
    for (int j = n; j; --j) {
      nxt[j][i] = nxt[j + 1][i];
      if (s[j] - 'a' == i) nxt[j][i] = j;
    }
  }
  char ch1, ch2, id, cmd[10];
  while (m--) {
    getchar();
    scanf("%[^'\n']s", cmd);
    ch1 = cmd[0];
    id = cmd[2] - '0';
    if (ch1 == '+') {
      ch2 = cmd[4];
      t[id][++len[id]] = ch2;
      update(id);
    } else if (ch1 == '-') {
      --len[id];
    }
    if (dp[len[1]][len[2]][len[3]] != INF)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
