#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5 + 5;
const int LMAX = 255;
int lookup[30][NMAX], dp[LMAX][LMAX][LMAX];
char s[3][LMAX];
char univ[NMAX];
char line[105];
int I[3];
int main() {
  int N, Q, i, k, j;
  cin >> N >> Q;
  cin >> (univ + 1);
  for (i = 0; i < 26; ++i)
    for (j = 0; j <= N; ++j) lookup[i][j] = -1;
  for (i = 0; i < 26; ++i) {
    for (j = N - 1; j >= 0; --j) {
      if (univ[j + 1] == ('a' + i))
        lookup[i][j] = j + 1;
      else
        lookup[i][j] = lookup[i][j + 1];
    }
  }
  for (i = 0; i <= 250; ++i)
    for (j = 0; j <= 250; ++j)
      for (k = 0; k <= 250; ++k) dp[i][j][k] = -1;
  dp[0][0][0] = 0;
  cin.getline(line, 20);
  while (Q--) {
    cin.getline(line, 100);
    int ind = line[2] - '1';
    int next[2] = {(ind + 1) % 3, (ind + 2) % 3};
    int newind[3];
    int smallind[3];
    if (line[0] == '-') {
      for (i = 0; i <= I[next[0]]; ++i) {
        for (j = 0; j <= I[next[1]]; ++j) {
          smallind[next[0]] = i;
          smallind[next[1]] = j;
          smallind[ind] = I[ind];
          dp[smallind[0]][smallind[1]][smallind[2]] = -1;
        }
      }
      I[ind]--;
    } else {
      s[ind][++I[ind]] = line[4];
      smallind[ind] = I[ind];
      int w;
      for (w = 0; w <= I[next[0]] + I[next[1]]; ++w) {
        for (i = 0; i <= I[next[0]]; ++i) {
          j = w - i;
          if (j >= 0 && j <= I[next[1]]) {
            smallind[next[0]] = i;
            smallind[next[1]] = j;
            newind[next[0]] = i;
            newind[next[1]] = j;
            newind[ind] = I[ind];
            for (k = 0; k < 3; ++k) {
              newind[k]--;
              char ch = s[k][smallind[k]];
              if (dp[newind[0]][newind[1]][newind[2]] >= 0 && newind[k] >= 0 &&
                  lookup[s[k][smallind[k]] - 'a']
                        [dp[newind[0]][newind[1]][newind[2]]] != -1) {
                if (dp[smallind[0]][smallind[1]][smallind[2]] == -1)
                  dp[smallind[0]][smallind[1]][smallind[2]] =
                      lookup[s[k][smallind[k]] - 'a']
                            [dp[newind[0]][newind[1]][newind[2]]];
                else
                  dp[smallind[0]][smallind[1]][smallind[2]] =
                      min(dp[smallind[0]][smallind[1]][smallind[2]],
                          lookup[s[k][smallind[k]] - 'a']
                                [dp[newind[0]][newind[1]][newind[2]]]);
              }
              newind[k]++;
            }
          }
        }
      }
    }
    if (dp[I[0]][I[1]][I[2]] != -1)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
