#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 1e18;
template <typename T>
void read(T &x) {
  x = 0;
  int s = 1, c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') s = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  x *= s;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
const int maxn = 1e5 + 5;
int n, q;
char s[maxn];
int nxt[maxn][30];
const int maxl = 255;
char t[4][maxl];
int Len[4];
int dp[maxl][maxl][maxl];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> q >> (s + 1);
  for (int i = 0; i <= 25; i++) nxt[n + 1][i] = nxt[n][i] = n + 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= 25; j++) nxt[i][j] = nxt[i + 1][j];
    nxt[i][s[i + 1] - 'a'] = i + 1;
  }
  while (q--) {
    char op;
    int d;
    cin >> op >> d;
    if (op == '+') {
      ++Len[d];
      cin >> t[d][Len[d]];
      function<void(int &, int)> Min = [&](int &x, int y) {
        if (x > y) x = y;
      };
      for (int i = (d == 1 ? Len[1] : 0); i <= Len[1]; i++)
        for (int j = (d == 2 ? Len[2] : 0); j <= Len[2]; j++)
          for (int k = (d == 3 ? Len[3] : 0); k <= Len[3]; k++) {
            dp[i][j][k] = n + 1;
            if (!i && !j && !k) dp[i][j][k] = 0;
            if (i) Min(dp[i][j][k], nxt[dp[i - 1][j][k]][t[1][i] - 'a']);
            if (j) Min(dp[i][j][k], nxt[dp[i][j - 1][k]][t[2][j] - 'a']);
            if (k) Min(dp[i][j][k], nxt[dp[i][j][k - 1]][t[3][k] - 'a']);
          }
    } else {
      Len[d]--;
    }
    cout << (dp[Len[1]][Len[2]][Len[3]] <= n ? "YES\n" : "NO\n");
  }
  return 0;
}
