#include <bits/stdc++.h>
using namespace std;
int dp[252][252][252];
vector<int> let[26];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  string ws;
  cin >> ws;
  for (int i = 0; i < n; i++) {
    let[ws[i] - 'a'].push_back(i + 1);
  }
  dp[0][0][0] = 0;
  string s1, s2, s3;
  while (q--) {
    char cc;
    cin >> cc;
    int i;
    char ad;
    if (cc == '+') {
      cin >> i >> ad;
      ad -= 'a';
      if (i == 1) {
        for (int j1 = 0; j1 <= s2.size(); j1++) {
          for (int k1 = 0; k1 <= s3.size(); k1++) {
            int l = dp[s1.size()][j1][k1];
            int m = -1;
            if (l != -1) {
              auto m1It = upper_bound(let[ad].begin(), let[ad].end(), l);
              m = (m1It != let[ad].end() ? *m1It : -1);
            }
            if (j1 > 0) {
              int c = s2[j1 - 1] - 'a';
              l = dp[s1.size() + 1][j1 - 1][k1];
              if (l != -1) {
                auto m1It = upper_bound(let[c].begin(), let[c].end(), l);
                int m1 = (m1It != let[c].end() ? *m1It : -1);
                if (m1 != -1 && (m == -1 || m > m1)) m = m1;
              }
            }
            if (k1 > 0) {
              int c = s3[k1 - 1] - 'a';
              l = dp[s1.size() + 1][j1][k1 - 1];
              if (l != -1) {
                auto m1It = upper_bound(let[c].begin(), let[c].end(), l);
                int m1 = (m1It != let[c].end() ? *m1It : -1);
                if (m1 != -1 && (m == -1 || m > m1)) m = m1;
              }
            }
            dp[s1.size() + 1][j1][k1] = m;
          }
        }
        s1 += (ad + 'a');
      } else if (i == 2) {
        for (int j1 = 0; j1 <= s1.size(); j1++) {
          for (int k1 = 0; k1 <= s3.size(); k1++) {
            int l = dp[j1][s2.size()][k1];
            int m = -1;
            if (l != -1) {
              auto m1It = upper_bound(let[ad].begin(), let[ad].end(), l);
              m = (m1It != let[ad].end() ? *m1It : -1);
            }
            if (j1 > 0) {
              int c = s1[j1 - 1] - 'a';
              l = dp[j1 - 1][s2.size() + 1][k1];
              if (l != -1) {
                auto m1It = upper_bound(let[c].begin(), let[c].end(), l);
                int m1 = (m1It != let[c].end() ? *m1It : -1);
                if (m1 != -1 && (m == -1 || m > m1)) m = m1;
              }
            }
            if (k1 > 0) {
              int c = s3[k1 - 1] - 'a';
              l = dp[j1][s2.size() + 1][k1 - 1];
              if (l != -1) {
                auto m1It = upper_bound(let[c].begin(), let[c].end(), l);
                int m1 = (m1It != let[c].end() ? *m1It : -1);
                if (m1 != -1 && (m == -1 || m > m1)) m = m1;
              }
            }
            dp[j1][s2.size() + 1][k1] = m;
          }
        }
        s2 += (ad + 'a');
      } else {
        for (int j1 = 0; j1 <= s1.size(); j1++) {
          for (int k1 = 0; k1 <= s2.size(); k1++) {
            int l = dp[j1][k1][s3.size()];
            int m = -1;
            if (l != -1) {
              auto m1It = upper_bound(let[ad].begin(), let[ad].end(), l);
              m = (m1It != let[ad].end() ? *m1It : -1);
            }
            if (j1 > 0) {
              int c = s1[j1 - 1] - 'a';
              l = dp[j1 - 1][k1][s3.size() + 1];
              if (l != -1) {
                auto m1It = upper_bound(let[c].begin(), let[c].end(), l);
                int m1 = (m1It != let[c].end() ? *m1It : -1);
                if (m1 != -1 && (m == -1 || m > m1)) m = m1;
              }
            }
            if (k1 > 0) {
              int c = s2[k1 - 1] - 'a';
              l = dp[j1][k1 - 1][s3.size() + 1];
              if (l != -1) {
                auto m1It = upper_bound(let[c].begin(), let[c].end(), l);
                int m1 = (m1It != let[c].end() ? *m1It : -1);
                if (m1 != -1 && (m == -1 || m > m1)) m = m1;
              }
            }
            dp[j1][k1][s3.size() + 1] = m;
          }
        }
        s3 += (ad + 'a');
      }
    } else {
      cin >> i;
      if (i == 1) {
        s1.pop_back();
      } else if (i == 2) {
        s2.pop_back();
      } else {
        s3.pop_back();
      }
    }
    cout << (dp[s1.size()][s2.size()][s3.size()] != -1 ? "YES\n" : "NO\n");
  }
  return 0;
}
