#include <bits/stdc++.h>
constexpr int INF = 1e9;
int main() {
  using namespace std;
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  vector<char> str(n + 1);
  for (int i = 1; i <= n; ++i) cin >> str[i];
  vector<array<int, 26>> next(n + 2);
  for (int i = 0; i < 26; ++i) {
    next[n + 1][i] = INF;
    for (int j = n; j; --j) {
      if (str[j] == 'a' + i) {
        next[j][i] = j;
      } else {
        next[j][i] = next[j + 1][i];
      }
    }
  }
  static array<int, 4> len;
  static array<array<char, 255>, 4> cur;
  static array<array<array<int, 255>, 255>, 255> dp;
  auto update = [&](int x) -> void {
    for (int i = x == 1 ? len[1] : 0; i <= len[1]; ++i) {
      for (int j = x == 2 ? len[2] : 0; j <= len[2]; ++j) {
        for (int k = x == 3 ? len[3] : 0; k <= len[3]; ++k) {
          dp[i][j][k] = INF;
          if (i && dp[i - 1][j][k] != INF) {
            dp[i][j][k] =
                min(dp[i][j][k], next[dp[i - 1][j][k] + 1][cur[1][i] - 'a']);
          }
          if (j && dp[i][j - 1][k] != INF) {
            dp[i][j][k] =
                min(dp[i][j][k], next[dp[i][j - 1][k] + 1][cur[2][j] - 'a']);
          }
          if (k && dp[i][j][k - 1] != INF) {
            dp[i][j][k] =
                min(dp[i][j][k], next[dp[i][j][k - 1] + 1][cur[3][k] - 'a']);
          }
        }
      }
    }
  };
  while (q--) {
    char c;
    cin >> c;
    if (c == '+') {
      int i;
      cin >> i >> c;
      cur[i][++len[i]] = c;
      update(i);
    } else {
      int i;
      cin >> i;
      --len[i];
    }
    cout << (dp[len[1]][len[2]][len[3]] != INF ? "YES\n" : "NO\n");
  }
}
