#include <bits/stdc++.h>
using namespace std;
int dp[255][255][255], after[100005][28];
char s[100005], ss[4][255], opt[3], c[3];
int n, q, id, len[4];
int main() {
  scanf("%d%d", &n, &q);
  scanf("%s", s + 1);
  memset(after, 0x3f, sizeof after);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      if (s[i + 1] == 'a' + j)
        after[i][j] = i + 1;
      else
        after[i][j] = after[i + 1][j];
    }
  }
  dp[0][0][0] = 0;
  int i, j, k;
  while (q--) {
    scanf("%s %d", opt, &id);
    if (opt[0] == '+') {
      scanf("%s", c);
      ss[id][++len[id]] = c[0];
      i = len[1], j = len[2], k = len[3];
      if (len[id] > n) continue;
      if (id == 1) {
        for (int jj = 0; jj <= j; jj++)
          for (int kk = 0; kk <= k; kk++) {
            if (dp[i - 1][jj][kk] < 0x3f3f3f3f)
              dp[i][jj][kk] = after[dp[i - 1][jj][kk]][ss[1][i] - 'a'];
            else
              dp[i][jj][kk] = 0x3f3f3f3f;
            if (jj > 0 && dp[i][jj - 1][kk] < 0x3f3f3f3f)
              dp[i][jj][kk] =
                  min(dp[i][jj][kk], after[dp[i][jj - 1][kk]][ss[2][jj] - 'a']);
            if (kk > 0 && dp[i][jj][kk - 1] < 0x3f3f3f3f)
              dp[i][jj][kk] =
                  min(dp[i][jj][kk], after[dp[i][jj][kk - 1]][ss[3][kk] - 'a']);
          }
      } else if (id == 2) {
        for (int ii = 0; ii <= i; ii++)
          for (int kk = 0; kk <= k; kk++) {
            if (dp[ii][j - 1][kk] < 0x3f3f3f3f)
              dp[ii][j][kk] = after[dp[ii][j - 1][kk]][ss[2][j] - 'a'];
            else
              dp[ii][j][kk] = 0x3f3f3f3f;
            if (ii > 0 && dp[ii - 1][j][kk] < 0x3f3f3f3f)
              dp[ii][j][kk] =
                  min(dp[ii][j][kk], after[dp[ii - 1][j][kk]][ss[1][ii] - 'a']);
            if (kk > 0 && dp[ii][j][kk - 1] < 0x3f3f3f3f)
              dp[ii][j][kk] =
                  min(dp[ii][j][kk], after[dp[ii][j][kk - 1]][ss[3][kk] - 'a']);
          }
      } else {
        for (int ii = 0; ii <= i; ii++)
          for (int jj = 0; jj <= j; jj++) {
            if (dp[ii][jj][k - 1] < 0x3f3f3f3f)
              dp[ii][jj][k] = after[dp[ii][jj][k - 1]][ss[3][k] - 'a'];
            else
              dp[ii][jj][k] = 0x3f3f3f3f;
            if (ii > 0 && dp[ii - 1][jj][k] < 0x3f3f3f3f)
              dp[ii][jj][k] =
                  min(dp[ii][jj][k], after[dp[ii - 1][jj][k]][ss[1][ii] - 'a']);
            if (jj > 0 && dp[ii][jj - 1][k] < 0x3f3f3f3f)
              dp[ii][jj][k] =
                  min(dp[ii][jj][k], after[dp[ii][jj - 1][k]][ss[2][jj] - 'a']);
          }
      }
    } else {
      len[id]--;
      i = len[1], j = len[2], k = len[3];
    }
    if (dp[i][j][k] <= n)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
