#include <bits/stdc++.h>   using namespace std;   const int Maxn = 1e5 + 2;   const int Nn = 251;   char s[Maxn];   int a[Maxn][26], f[Nn][Nn][Nn], length[3], i, j, k, l, Min, n, m, id, p;   char ss[3][Nn], op, c, sss[Nn];   void done() {     for (int i = 0; i < 26; i++) {       a[n][i] = n + 1;       a[n + 1][i] = n + 1;     }     for (int i = n - 1; i >= 0; i--) {       for (int j = 0; j < 26; j++) a[i][j] = a[i + 1][j];       a[i][s[i] -  a ] = i + 1;     }     f[0][0][0] = 0;   }   int pos(int i, int j, int k, char c) { return a[f[i][j][k]][c -  a ]; }   void func(int i, int j, int k) {     f[i][j][k] = n + 2;     if (i > 0) {       Min = pos(i - 1, j, k, ss[0][i]);       if (Min < f[i][j][k]) f[i][j][k] = Min;     }     if (j > 0) {       Min = pos(i, j - 1, k, ss[1][j]);       if (Min < f[i][j][k]) f[i][j][k] = Min;     }     if (k > 0) {       Min = pos(i, j, k - 1, ss[2][k]);       if (Min < f[i][j][k]) f[i][j][k] = Min;     }   }   int main() {     scanf( %d%d , &n, &m);     scanf( %s n , s);     done();     for (l = 0; l < m; l++) {       scanf( %c , &op);       switch (op) {         case  + :           scanf( %d %c , &id, &c);           gets(sss);           id %= 3;           ++length[id];           ss[id][length[id]] = c;           if (id == 0) {             for (j = 0; j <= length[1]; j++)               for (k = 0; k <= length[2]; k++) func(length[id], j, k);           }           if (id == 1) {             for (i = 0; i <= length[0]; i++)               for (k = 0; k <= length[2]; k++) func(i, length[id], k);           }           if (id == 2) {             for (i = 0; i <= length[0]; i++)               for (j = 0; j <= length[1]; j++) func(i, j, length[id]);           }           break;         case  - :           scanf(  %d , &id);           gets(sss);           id %= 3;           --length[id];           break;       }       p = f[length[0]][length[1]][length[2]];       if (p <= n)         printf( YES n );       else         printf( NO n );     }     return 0;   }   