#include <bits/stdc++.h>   using namespace std;   using ll = long long int;   using pii = pair<int, int>;   constexpr int ALPHABET_SIZE =  z  -  a  + 1;   constexpr int MAX_SIZE = 256;   constexpr int INF = 1e8;   int n;   string s;   string as, bs, cs;   vector<int> next_pos[ALPHABET_SIZE];   int calced_pos[MAX_SIZE][MAX_SIZE][MAX_SIZE];   int calced_mark[MAX_SIZE][MAX_SIZE][MAX_SIZE];   int added_mark[MAX_SIZE][MAX_SIZE][MAX_SIZE];   int dda[(int)3e5];   int ddb[(int)3e5];   int ddc[(int)3e5];   void promote(int s_pos, int mark, int type) {     int dsize = 0;     int dptr = 0;     if (type == 1) {       for (int bb = 0; bb <= bs.size(); bb++) {         for (int cc = 0; cc <= cs.size(); cc++) {           dda[dsize] = s_pos;           ddb[dsize] = bb;           ddc[dsize] = cc;           dsize++;           calced_mark[s_pos][bb][cc] = mark;           added_mark[s_pos][bb][cc] = mark;         }       }     } else if (type == 2) {       for (int aa = 0; aa <= as.size(); aa++) {         for (int cc = 0; cc <= cs.size(); cc++) {           dda[dsize] = aa;           ddb[dsize] = s_pos;           ddc[dsize] = cc;           dsize++;           calced_mark[aa][s_pos][cc] = mark;           added_mark[aa][s_pos][cc] = mark;         }       }     } else {       for (int aa = 0; aa <= as.size(); aa++) {         for (int bb = 0; bb <= bs.size(); bb++) {           dda[dsize] = aa;           ddb[dsize] = bb;           ddc[dsize] = s_pos;           dsize++;           calced_mark[aa][bb][s_pos] = mark;           added_mark[aa][bb][s_pos] = mark;         }       }     }     while (dptr < dsize) {       int a = dda[dptr];       int b = ddb[dptr];       int c = ddc[dptr];       dptr++;       int &m = calced_mark[a][b][c];       m = mark;       added_mark[a][b][c] = mark;       int &pos = calced_pos[a][b][c];       if (a == 0 && b == 0 && c == 0) {         pos = 0;       }       if (a < as.size()) {         int &p = calced_pos[a + 1][b][c];         int &mm = calced_mark[a + 1][b][c];         int &am = added_mark[a + 1][b][c];         if (am != mark) {           if (mm != mark) {             p = INF;             mm = mark;             dda[dsize] = a + 1;             ddb[dsize] = b;             ddc[dsize] = c;             dsize++;           }           if (pos < n) p = min(p, next_pos[as[a] -  a ][pos] + 1);         }       }       if (b < bs.size()) {         int &p = calced_pos[a][b + 1][c];         int &mm = calced_mark[a][b + 1][c];         int &am = added_mark[a][b + 1][c];         if (am != mark) {           if (mm != mark) {             p = INF;             mm = mark;             dda[dsize] = a;             ddb[dsize] = b + 1;             ddc[dsize] = c;             dsize++;           }           if (pos < n) p = min(p, next_pos[bs[b] -  a ][pos] + 1);         }       }       if (c < cs.size()) {         int &p = calced_pos[a][b][c + 1];         int &mm = calced_mark[a][b][c + 1];         int &am = added_mark[a][b][c + 1];         if (am != mark) {           if (mm != mark) {             p = INF;             mm = mark;             dda[dsize] = a;             ddb[dsize] = b;             ddc[dsize] = c + 1;             dsize++;           }           if (pos < n) p = min(p, next_pos[cs[c] -  a ][pos] + 1);         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int q;     cin >> n >> q;     cin >> s;     memset(calced_mark, 0, sizeof(calced_mark));     memset(added_mark, 0, sizeof(added_mark));     for (int i = 0; i < ALPHABET_SIZE; i++) {       next_pos[i].resize(n, INF);     }     for (int i = n - 1; i >= 0; i--) {       if (i + 1 < n) {         for (int z = 0; z < ALPHABET_SIZE; z++) {           next_pos[z][i] = next_pos[z][i + 1];         }       }       int c = s[i] -  a ;       next_pos[c][i] = i;     }     int mark = 228;     char c, which;     int num;     while (q--) {       mark++;       cin >> c >> num;       if (c ==  - ) {         if (num == 1) {           as.pop_back();         } else if (num == 2) {           bs.pop_back();         } else if (num == 3) {           cs.pop_back();         }       } else {         cin >> which;         if (num == 1) {           as.push_back(which);           promote(as.size() - 1, mark, num);         } else if (num == 2) {           bs.push_back(which);           promote(bs.size() - 1, mark, num);         } else if (num == 3) {           cs.push_back(which);           promote(cs.size() - 1, mark, num);         }       }       cout << (calced_pos[as.size()][bs.size()][cs.size()] <= s.size() ?  YES                                                                         :  NO )            << endl;     }   }