#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
template <class T, class S>
inline void add(T& a, S b) {
  a += b;
  if (a >= mod) a -= mod;
}
template <class T, class S>
inline void sub(T& a, S b) {
  a -= b;
  if (a < 0) a += mod;
}
template <class T, class S>
inline bool chkmax(T& a, S b) {
  return a < b ? a = b, true : false;
}
template <class T, class S>
inline bool chkmin(T& a, S b) {
  return a > b ? a = b, true : false;
}
int n, q, who;
int dp[256][256][256];
int len[3], nex[N][26];
char s[N], op[3], t[3][N];
inline int getNex(int p, char c) { return nex[p][c - 'a']; }
int main() {
  scanf("%d%d", &n, &q);
  scanf("%s", s + 1);
  for (int c = 0; c < 26; c++) nex[n][c] = n + 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int c = 0; c < 26; c++) nex[i][c] = nex[i + 1][c];
    nex[i][s[i + 1] - 'a'] = i + 1;
  }
  for (int i = 0; i < 256; i++)
    for (int j = 0; j < 256; j++)
      for (int k = 0; k < 256; k++) dp[i][j][k] = n + 1;
  dp[0][0][0] = 0;
  while (q--) {
    scanf("%s%d", op, &who);
    who--;
    if (op[0] == '+') {
      scanf("%s", op);
      char ch = op[0];
      t[who][++len[who]] = ch;
      if (who == 0) {
        for (int y = 0; y <= len[1]; y++)
          for (int z = 0; z <= len[2]; z++) dp[len[who]][y][z] = n + 1;
        for (int x = len[0] - 1; x <= len[0]; x++) {
          for (int y = 0; y <= len[1]; y++) {
            for (int z = 0; z <= len[2]; z++) {
              if (dp[x][y][z] >= n) continue;
              if (x < len[0])
                chkmin(dp[x + 1][y][z], getNex(dp[x][y][z], t[0][x + 1]));
              if (y < len[1])
                chkmin(dp[x][y + 1][z], getNex(dp[x][y][z], t[1][y + 1]));
              if (z < len[2])
                chkmin(dp[x][y][z + 1], getNex(dp[x][y][z], t[2][z + 1]));
            }
          }
        }
      } else if (who == 1) {
        for (int x = 0; x <= len[0]; x++)
          for (int z = 0; z <= len[2]; z++) dp[x][len[who]][z] = n + 1;
        for (int x = 0; x <= len[0]; x++) {
          for (int y = len[1] - 1; y <= len[1]; y++) {
            for (int z = 0; z <= len[2]; z++) {
              if (dp[x][y][z] >= n) continue;
              if (x < len[0])
                chkmin(dp[x + 1][y][z], getNex(dp[x][y][z], t[0][x + 1]));
              if (y < len[1])
                chkmin(dp[x][y + 1][z], getNex(dp[x][y][z], t[1][y + 1]));
              if (z < len[2])
                chkmin(dp[x][y][z + 1], getNex(dp[x][y][z], t[2][z + 1]));
            }
          }
        }
      } else if (who == 2) {
        for (int x = 0; x <= len[0]; x++)
          for (int y = 0; y <= len[1]; y++) dp[x][y][len[who]] = n + 1;
        for (int x = 0; x <= len[0]; x++) {
          for (int y = 0; y <= len[1]; y++) {
            for (int z = len[2] - 1; z <= len[2]; z++) {
              if (dp[x][y][z] >= n) continue;
              if (x < len[0])
                chkmin(dp[x + 1][y][z], getNex(dp[x][y][z], t[0][x + 1]));
              if (y < len[1])
                chkmin(dp[x][y + 1][z], getNex(dp[x][y][z], t[1][y + 1]));
              if (z < len[2])
                chkmin(dp[x][y][z + 1], getNex(dp[x][y][z], t[2][z + 1]));
            }
          }
        }
      }
    } else {
      len[who]--;
    }
    puts(dp[len[0]][len[1]][len[2]] <= n ? "YES" : "NO");
  }
  return 0;
}
