#include <bits/stdc++.h>
using namespace std;
constexpr long long TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (int i = 0; i < (v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}
const int maxn = 100010;
const int maxl = 260;
inline void chmin(int& x, int y) {
  if (x > y) x = y;
}
int nx[30][maxn];
int dp[maxl][maxl][maxl];
int main() {
  int n, q;
  cin >> n >> q;
  string sx;
  cin >> sx;
  for (int j = 0; j < (26); j++) nx[j][n] = n;
  for (int i = n - 1; i >= 0; --i) {
    int c = sx[i] - 'a';
    for (int j = 0; j < (26); j++) nx[j][i] = nx[j][i + 1];
    nx[c][i] = i;
  }
  for (int j = 0; j < (maxl); j++)
    for (int k = 0; k < (maxl); k++)
      for (int l = 0; l < (maxl); l++) dp[j][k][l] = maxn;
  dp[0][0][0] = 0;
  string s[3];
  for (int i = 0; i < (q); i++) {
    char type, cc = '!';
    int id;
    cin >> type >> id;
    --id;
    if (type == '+') {
      cin >> cc;
      s[id].push_back(cc);
      int sl = s[id].size();
      if (id == 0) {
        for (int k = 0; k < (s[1].size() + 1); k++)
          for (int l = 0; l < (s[2].size() + 1); l++) {
            if (sl > 0 && dp[sl - 1][k][l] < n) {
              int c = s[0].back() - 'a';
              chmin(dp[sl][k][l], nx[c][dp[sl - 1][k][l]] + 1);
            }
            if (k > 0 && dp[sl][k - 1][l] < n) {
              int c = s[1][k - 1] - 'a';
              chmin(dp[sl][k][l], nx[c][dp[sl][k - 1][l]] + 1);
            }
            if (l > 0 && dp[sl][k][l - 1] < n) {
              int c = s[2][l - 1] - 'a';
              chmin(dp[sl][k][l], nx[c][dp[sl][k][l - 1]] + 1);
            }
          }
      } else if (id == 1) {
        for (int k = 0; k < (s[0].size() + 1); k++)
          for (int l = 0; l < (s[2].size() + 1); l++) {
            if (sl > 0 && dp[k][sl - 1][l] < n) {
              int c = s[1].back() - 'a';
              chmin(dp[k][sl][l], nx[c][dp[k][sl - 1][l]] + 1);
            }
            if (k > 0 && dp[k - 1][sl][l] < n) {
              int c = s[0][k - 1] - 'a';
              chmin(dp[k][sl][l], nx[c][dp[k - 1][sl][l]] + 1);
            }
            if (l > 0 && dp[k][sl][l - 1] < n) {
              int c = s[2][l - 1] - 'a';
              chmin(dp[k][sl][l], nx[c][dp[k][sl][l - 1]] + 1);
            }
          }
      } else {
        for (int k = 0; k < (s[0].size() + 1); k++)
          for (int l = 0; l < (s[1].size() + 1); l++) {
            if (sl > 0 && dp[k][l][sl - 1] < n) {
              int c = s[2].back() - 'a';
              chmin(dp[k][l][sl], nx[c][dp[k][l][sl - 1]] + 1);
            }
            if (k > 0 && dp[k - 1][l][sl] < n) {
              int c = s[0][k - 1] - 'a';
              chmin(dp[k][l][sl], nx[c][dp[k - 1][l][sl]] + 1);
            }
            if (l > 0 && dp[k][l - 1][sl] < n) {
              int c = s[1][l - 1] - 'a';
              chmin(dp[k][l][sl], nx[c][dp[k][l - 1][sl]] + 1);
            }
          }
      }
    } else {
      int sl = s[id].size();
      if (id == 0) {
        for (int k = 0; k < (maxl); k++)
          for (int l = 0; l < (maxl); l++) {
            dp[sl][k][l] = maxn;
          }
      } else if (id == 1) {
        for (int k = 0; k < (maxl); k++)
          for (int l = 0; l < (maxl); l++) {
            dp[k][sl][l] = maxn;
          }
      } else {
        for (int k = 0; k < (maxl); k++)
          for (int l = 0; l < (maxl); l++) {
            dp[k][l][sl] = maxn;
          }
      }
      s[id].pop_back();
    }
    puts(dp[s[0].size()][s[1].size()][s[2].size()] <= n ? "YES" : "NO");
  }
  return 0;
}
