#include <bits/stdc++.h>
using namespace std;
char a[100010];
int ch[26];
int nex[100010][26];
int dp[252][252][252];
int l[3];
char b[3][252];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i <= 250; i++)
    for (int y = 0; y <= 250; y++)
      for (int z = 0; z <= 250; z++) dp[i][y][z] = n + 1;
  dp[0][0][0] = 0;
  for (int i = 1; i <= n; i++) scanf(" %1c", &a[i]);
  for (int i = 0; i < 26; i++) ch[i] = n + 1;
  for (int i = n; i >= 0; i--) {
    for (int y = 0; y < 26; y++) nex[i][y] = ch[y];
    if (i) ch[a[i] - 'a'] = i;
  }
  while (m--) {
    char q;
    scanf(" %1c", &q);
    if (q == '+') {
      int w;
      char e;
      scanf("%d %1c", &w, &e);
      w--;
      l[w]++;
      b[w][l[w]] = e;
      if (w == 0) {
        int i = l[0];
        for (int y = 0; y <= l[1]; y++) {
          for (int z = 0; z <= l[2]; z++) {
            dp[i][y][z] = n + 1;
            if (i && dp[i - 1][y][z] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i - 1][y][z]][b[0][i] - 'a']);
            if (y && dp[i][y - 1][z] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i][y - 1][z]][b[1][y] - 'a']);
            if (z && dp[i][y][z - 1] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i][y][z - 1]][b[2][z] - 'a']);
          }
        }
      } else if (w == 1) {
        int y = l[1];
        for (int i = 0; i <= l[0]; i++) {
          for (int z = 0; z <= l[2]; z++) {
            dp[i][y][z] = n + 1;
            if (i && dp[i - 1][y][z] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i - 1][y][z]][b[0][i] - 'a']);
            if (y && dp[i][y - 1][z] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i][y - 1][z]][b[1][y] - 'a']);
            if (z && dp[i][y][z - 1] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i][y][z - 1]][b[2][z] - 'a']);
          }
        }
      } else {
        int z = l[2];
        for (int i = 0; i <= l[0]; i++) {
          for (int y = 0; y <= l[1]; y++) {
            dp[i][y][z] = n + 1;
            if (i && dp[i - 1][y][z] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i - 1][y][z]][b[0][i] - 'a']);
            if (y && dp[i][y - 1][z] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i][y - 1][z]][b[1][y] - 'a']);
            if (z && dp[i][y][z - 1] != n + 1)
              dp[i][y][z] =
                  min(dp[i][y][z], nex[dp[i][y][z - 1]][b[2][z] - 'a']);
          }
        }
      }
      if (dp[l[0]][l[1]][l[2]] <= n)
        puts("YES");
      else
        puts("NO");
    } else {
      int w;
      scanf("%d", &w);
      w--;
      b[w][l[w]] = 0;
      l[w]--;
      if (dp[l[0]][l[1]][l[2]] <= n)
        puts("YES");
      else
        puts("NO");
    }
  }
}
