#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const int maxm = 260;
int Next[maxn][30], n, m, dp[maxm][maxm][maxm], len[4];
char s[maxn], ss[5][maxm];
void init() {
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  for (int i = n; i >= 1; i--) {
    if (i == n) {
      for (int j = 0; j < 30; j++) {
        Next[i][j] = n + 1;
        Next[i + 1][j] = n + 1;
      }
    }
    for (int j = 0; j < 30; j++) {
      Next[i - 1][j] = Next[i][j];
    }
    Next[i - 1][s[i] - 'a'] = i;
  }
}
int main() {
  init();
  while (m--) {
    char op[5];
    scanf("%s", op);
    if (*op == '-') {
      int w;
      scanf("%d", &w);
      len[w]--;
    } else {
      int w;
      scanf("%d%s", &w, op);
      ss[w][++len[w]] = *op;
      int W1, W2, W3;
      W1 = W2 = W3 = 0;
      if (w == 1)
        W1 = len[w];
      else if (w == 2)
        W2 = len[w];
      else
        W3 = len[w];
      for (int w1 = W1; w1 <= len[1]; w1++) {
        for (int w2 = W2; w2 <= len[2]; w2++) {
          for (int w3 = W3; w3 <= len[3]; w3++) {
            dp[w1][w2][w3] = n + 1;
            if (w1)
              dp[w1][w2][w3] = min(dp[w1][w2][w3],
                                   Next[dp[w1 - 1][w2][w3]][ss[1][w1] - 'a']);
            if (w2)
              dp[w1][w2][w3] = min(dp[w1][w2][w3],
                                   Next[dp[w1][w2 - 1][w3]][ss[2][w2] - 'a']);
            if (w3)
              dp[w1][w2][w3] = min(dp[w1][w2][w3],
                                   Next[dp[w1][w2][w3 - 1]][ss[3][w3] - 'a']);
          }
        }
      }
    }
    if (dp[len[1]][len[2]][len[3]] >= n + 1)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
