#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
char ss[MAX];
int trie[MAX][28];
char s[4][MAX];
int top[4], up[4], down[4];
int dp[255][255][255];
int main() {
  int n, q;
  cin >> n >> q;
  cin >> (ss + 1);
  for (int i = 0; i <= 26; i++) trie[n + 1][i] = trie[n + 2][i] = n + 1;
  ss[0] = 0;
  for (int i = n; i >= 0; i--) {
    int cur = ss[i] - 'a';
    for (int j = 0; j < 26; j++) {
      if (j == cur)
        trie[i][j] = i;
      else
        trie[i][j] = trie[i + 1][j];
    }
  }
  char op[5], tmp[5];
  int id;
  while (q--) {
    scanf("%s", op);
    if (op[0] == '+') {
      scanf("%d", &id);
      scanf("%s", tmp);
      s[id][++top[id]] = tmp[0];
      for (int i = 1; i <= 3; i++)
        down[i] = (i == id ? top[i] : 0), up[i] = top[i];
      for (int i = down[1]; i <= up[1]; i++) {
        for (int j = down[2]; j <= up[2]; j++) {
          for (int k = down[3]; k <= up[3]; k++) {
            dp[i][j][k] = n + 1;
            if (i)
              dp[i][j][k] =
                  min(dp[i][j][k], trie[dp[i - 1][j][k] + 1][s[1][i] - 'a']);
            if (j)
              dp[i][j][k] =
                  min(dp[i][j][k], trie[dp[i][j - 1][k] + 1][s[2][j] - 'a']);
            if (k)
              dp[i][j][k] =
                  min(dp[i][j][k], trie[dp[i][j][k - 1] + 1][s[3][k] - 'a']);
          }
        }
      }
    } else {
      scanf("%d", &id);
      top[id]--;
    }
    if (dp[top[1]][top[2]][top[3]] > n)
      puts("NO");
    else
      puts("YES");
  }
  return 0;
}
