#include <bits/stdc++.h>
using namespace std;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T>
void ndarray(vector<T> &vec, int len) {
  vec.resize(len);
}
template <typename T, typename... Args>
void ndarray(vector<T> &vec, int len, Args... args) {
  vec.resize(len);
  for (auto &v : vec) ndarray(v, args...);
}
template <typename T>
bool mmax(T &m, const T q) {
  if (m < q) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T>
bool mmin(T &m, const T q) {
  if (m > q) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) {
  return make_pair(l.first + r.first, l.second + r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) {
  return make_pair(l.first - r.first, l.second - r.second);
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto v : vec) os << v << ",";
  os << "]";
  return os;
}
constexpr int M = 251;
constexpr int INF = 100000000;
int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<vector<vector<int>>> dp;
  ndarray(dp, M, M, M);
  for (int i = (0), i_end_ = (M); i < i_end_; i++)
    for (int j = (0), j_end_ = (M); j < j_end_; j++)
      for (int k = (0), k_end_ = (M); k < k_end_; k++) dp[i][j][k] = INF;
  dp[0][0][0] = -1;
  vector<vector<int>> search;
  ndarray(search, 26, S.length());
  for (int c = (0), c_end_ = (26); c < c_end_; c++) {
    int now = INF;
    for (int i = (S.length()) - 1, i_begin_ = (0); i >= i_begin_; i--) {
      if (S[i] - 'a' == c) now = i;
      search[c][i] = now;
    }
  }
  vector<string> word(3);
  for (int i = (0), i_end_ = (Q); i < i_end_; i++) {
    char c;
    int j;
    cin >> c >> j;
    j--;
    if (c == '+') {
      char v;
      cin >> v;
      word[j].push_back(v);
      for (int s = (0), s_end_ = (M); s < s_end_; s++)
        for (int t = (0), t_end_ = (M); t < t_end_; t++) {
          int l, m, n;
          if (j == 0)
            l = word[j].length(), m = s, n = t;
          else if (j == 1)
            l = s, m = word[j].length(), n = t;
          else
            l = s, m = t, n = word[j].length();
          if (l + m + n == 0) continue;
          dp[l][m][n] = INF;
          if (l > 0 and l - 1 < word[0].size() and dp[l - 1][m][n] + 1 < N)
            mmin(dp[l][m][n],
                 search[word[0][l - 1] - 'a'][dp[l - 1][m][n] + 1]);
          if (m > 0 and m - 1 < word[1].size() and dp[l][m - 1][n] + 1 < N)
            mmin(dp[l][m][n],
                 search[word[1][m - 1] - 'a'][dp[l][m - 1][n] + 1]);
          if (n > 0 and n - 1 < word[2].size() and dp[l][m][n - 1] + 1 < N)
            mmin(dp[l][m][n],
                 search[word[2][n - 1] - 'a'][dp[l][m][n - 1] + 1]);
        }
    } else
      word[j].pop_back();
    if (dp[word[0].length()][word[1].length()][word[2].length()] < INF)
      puts("YES");
    else
      puts("NO");
  }
}
