#include <bits/stdc++.h>
using namespace std;
const int A = 'z' - 'a' + 1;
const int N = 1e5;
const int N2 = 25e1;
int n, q;
string s, t[3];
int a[N + 1][A], dp[N2 + 1][N2 + 1][N2 + 1];
void process() {
  cin >> n >> q >> s;
  int j[A];
  for (int i = 0; i < A; ++i) j[i] = N;
  for (int i = n; i >= 0; --i) {
    if (i < n) j[s[i] - 'a'] = i;
    for (int i2 = 0; i2 < A; ++i2) a[i][i2] = j[i2];
  }
  dp[0][0][0] = 0;
  int i2;
  char c, c2;
  for (int i = 0; i < q; ++i) {
    cin >> c;
    if (c == '+') {
      cin >> i2 >> c2;
      t[--i2].push_back(c2);
      int a2[3] = {0, 0, 0};
      a2[i2] = t[i2].size();
      for (int i3 = a2[0]; i3 <= t[0].size(); ++i3)
        for (int i4 = a2[1]; i4 <= t[1].size(); ++i4)
          for (int i5 = a2[2]; i5 <= t[2].size(); ++i5) {
            int &dp2 = dp[i3][i4][i5];
            dp2 = N + 1;
            if (i3 > 0 && dp[i3 - 1][i4][i5] <= n)
              dp2 = min(dp2, a[dp[i3 - 1][i4][i5]][t[0][i3 - 1] - 'a'] + 1);
            if (i4 > 0 && dp[i3][i4 - 1][i5] <= n)
              dp2 = min(dp2, a[dp[i3][i4 - 1][i5]][t[1][i4 - 1] - 'a'] + 1);
            if (i5 > 0 && dp[i3][i4][i5 - 1] <= n)
              dp2 = min(dp2, a[dp[i3][i4][i5 - 1]][t[2][i5 - 1] - 'a'] + 1);
          }
    } else {
      cin >> i2;
      t[--i2].pop_back();
    }
    bool ans;
    ans = (dp[t[0].size()][t[1].size()][t[2].size()] <= n);
    cout << (ans ? "YES\n" : "NO\n");
  }
}
int main() { process(); }
