#include <bits/stdc++.h>
using namespace std;
const int INF = 5e7;
int dp[252][252][252], last[27], nxt[100005][27];
char s[100005], w[4][1005];
int n, m, len[4];
void reset(int u, int v, int q) {
  if (!(u + v + q)) {
    dp[u][v][q] = 0;
    return;
  }
  dp[u][v][q] = INF;
  if (u && INF > dp[u - 1][v][q])
    dp[u][v][q] = min(dp[u][v][q], nxt[dp[u - 1][v][q]][w[1][u] - 'a']);
  if (v && INF > dp[u][v - 1][q])
    dp[u][v][q] = min(dp[u][v][q], nxt[dp[u][v - 1][q]][w[2][v] - 'a']);
  if (q && INF > dp[u][v][q - 1])
    dp[u][v][q] = min(dp[u][v][q], nxt[dp[u][v][q - 1]][w[3][q] - 'a']);
}
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", s + 1);
  char f[2], c[2];
  for (int i = 0; i < 26; i++) last[i] = INF;
  for (int i = n; i >= 0; i--) {
    for (int j = 0; j < 26; j++) nxt[i][j] = last[j];
    if (i) last[s[i] - 'a'] = i;
  }
  int u;
  for (int qqq = 1; qqq <= m; qqq++) {
    scanf("%s", f);
    if (f[0] == '+') {
      scanf("%d%s", &u, c);
      ++len[u];
      w[u][len[u]] = c[0];
      if (u == 1) {
        for (int i = 0; i <= len[2]; i++)
          for (int j = 0; j <= len[3]; j++) reset(len[1], i, j);
      }
      if (u == 2) {
        for (int i = 0; i <= len[1]; i++)
          for (int j = 0; j <= len[3]; j++) reset(i, len[2], j);
      }
      if (u == 3) {
        for (int i = 0; i <= len[1]; i++)
          for (int j = 0; j <= len[2]; j++) reset(i, j, len[3]);
      }
    } else {
      scanf("%d", &u);
      --len[u];
    }
    if (dp[len[1]][len[2]][len[3]] <= n)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
