#include <bits/stdc++.h>
using namespace std;
const int N = 250 + 5;
const int M = 100000 + 5;
int dp[N][N][N];
int nxt[M][26];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  string str;
  cin >> str;
  memset(nxt, 0x3f, sizeof(nxt));
  for (int i = n; i > 0; --i) {
    for (int j = 0; j < 26; ++j) {
      nxt[i][j] = nxt[i + 1][j];
    }
    nxt[i][str[i - 1] - 'a'] = i;
  }
  vector<char> r1(N);
  vector<char> r2(N);
  vector<char> r3(N);
  int n1, n2, n3;
  n1 = n2 = n3 = 0;
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0][0] = 0;
  while (q--) {
    char cmd[5];
    int reli;
    cin >> cmd >> reli;
    reli--;
    if (cmd[0] == '+') {
      int last = 0x3f3f3f3f;
      cin >> cmd;
      if (reli == 0) {
        r1[n1++] = cmd[0];
        for (int i = 0; i <= n2; ++i) {
          for (int j = 0; j <= n3; ++j) {
            dp[n1][i][j] = 0x3f3f3f3f;
            if (i && dp[n1][i - 1][j] != 0x3f3f3f3f)
              dp[n1][i][j] =
                  min(nxt[dp[n1][i - 1][j] + 1][r2[i - 1] - 'a'], dp[n1][i][j]);
            if (j && dp[n1][i][j - 1] != 0x3f3f3f3f)
              dp[n1][i][j] =
                  min(nxt[dp[n1][i][j - 1] + 1][r3[j - 1] - 'a'], dp[n1][i][j]);
            if (dp[n1 - 1][i][j] != 0x3f3f3f3f)
              dp[n1][i][j] = min(nxt[dp[n1 - 1][i][j] + 1][r1[n1 - 1] - 'a'],
                                 dp[n1][i][j]);
          }
        }
        last = min(last, dp[n1][n2][n3]);
      } else if (reli == 1) {
        r2[n2++] = cmd[0];
        for (int i = 0; i <= n1; ++i) {
          for (int j = 0; j <= n3; ++j) {
            dp[i][n2][j] = 0x3f3f3f3f;
            if (i && dp[i - 1][n2][j] != 0x3f3f3f3f)
              dp[i][n2][j] =
                  min(nxt[dp[i - 1][n2][j] + 1][r1[i - 1] - 'a'], dp[i][n2][j]);
            if (j && dp[i][n2][j - 1] != 0x3f3f3f3f)
              dp[i][n2][j] =
                  min(nxt[dp[i][n2][j - 1] + 1][r3[j - 1] - 'a'], dp[i][n2][j]);
            if (dp[i][n2 - 1][j] != 0x3f3f3f3f)
              dp[i][n2][j] = min(nxt[dp[i][n2 - 1][j] + 1][r2[n2 - 1] - 'a'],
                                 dp[i][n2][j]);
          }
        }
        last = min(last, dp[n1][n2][n3]);
      } else if (reli == 2) {
        r3[n3++] = cmd[0];
        for (int i = 0; i <= n1; ++i) {
          for (int j = 0; j <= n2; ++j) {
            dp[i][j][n3] = 0x3f3f3f3f;
            if (i && dp[i - 1][j][n3] != 0x3f3f3f3f)
              dp[i][j][n3] =
                  min(nxt[dp[i - 1][j][n3] + 1][r1[i - 1] - 'a'], dp[i][j][n3]);
            if (j && dp[i][j - 1][n3] != 0x3f3f3f3f)
              dp[i][j][n3] =
                  min(nxt[dp[i][j - 1][n3] + 1][r2[j - 1] - 'a'], dp[i][j][n3]);
            if (dp[i][j][n3 - 1] != 0x3f3f3f3f)
              dp[i][j][n3] = min(nxt[dp[i][j][n3 - 1] + 1][r3[n3 - 1] - 'a'],
                                 dp[i][j][n3]);
          }
        }
        last = min(last, dp[n1][n2][n3]);
      }
      puts(last == 0x3f3f3f3f ? "NO" : "YES");
    } else {
      if (reli == 0)
        n1--;
      else if (reli == 1)
        n2--;
      else
        n3--;
      puts(dp[n1][n2][n3] == 0x3f3f3f3f ? "NO" : "YES");
    }
  }
  return 0;
}
