#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int INFL = 1e18;
const int MAX_N = 1e5 + 10;
const int MAX_Q = 1e3;
const int MAX_L = 256;
int nxt[MAX_N][26];
int dp[MAX_L][MAX_L][MAX_L];
int len[3];
char chs[3][MAX_L];
char org[MAX_N];
int main(void) {
  cin.sync_with_stdio(false), cin.tie(NULL);
  int N, Q;
  cin >> N >> Q;
  for (int i = 1; i <= N; i++) cin >> org[i];
  for (int i = 0; i < 26; i++) nxt[N + 1][i] = nxt[N + 2][i] = N + 2;
  for (int i = N; i >= 0; i--) {
    for (int j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
    if (i != 0) nxt[i][org[i] - 'a'] = i;
  }
  memset(dp, 0x3f, sizeof dp);
  dp[0][0][0] = 0;
  while (Q--) {
    char ch;
    int r;
    cin >> ch >> r;
    r--;
    if (ch == '+') {
      cin >> ch;
      chs[r][len[r]] = ch - 'a';
      len[r]++;
      if (r == 0) {
        int i = len[0];
        for (int j = 0; j <= len[1]; j++) {
          for (int k = 0; k <= len[2]; k++) {
            dp[i][j][k] = N + 2;
            if (i > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i - 1][j][k]][chs[0][i - 1]]);
            if (j > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i][j - 1][k]][chs[1][j - 1]]);
            if (k > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i][j][k - 1]][chs[2][k - 1]]);
            if (dp[i][j][k] != N + 2) dp[i][j][k]++;
          }
        }
      } else if (r == 1) {
        int j = len[1];
        for (int i = 0; i <= len[0]; i++) {
          for (int k = 0; k <= len[2]; k++) {
            dp[i][j][k] = N + 2;
            if (i > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i - 1][j][k]][chs[0][i - 1]]);
            if (j > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i][j - 1][k]][chs[1][j - 1]]);
            if (k > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i][j][k - 1]][chs[2][k - 1]]);
            if (dp[i][j][k] != N + 2) dp[i][j][k]++;
          }
        }
      } else {
        int k = len[2];
        for (int i = 0; i <= len[0]; i++) {
          for (int j = 0; j <= len[1]; j++) {
            dp[i][j][k] = N + 2;
            if (i > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i - 1][j][k]][chs[0][i - 1]]);
            if (j > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i][j - 1][k]][chs[1][j - 1]]);
            if (k > 0)
              dp[i][j][k] =
                  min(dp[i][j][k], nxt[dp[i][j][k - 1]][chs[2][k - 1]]);
            if (dp[i][j][k] != N + 2) dp[i][j][k]++;
          }
        }
      }
    } else {
      len[r]--;
    }
    if (dp[len[0]][len[1]][len[2]] <= N + 1)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  return 0;
}
