#include <bits/stdc++.h>
using namespace std;
int N, Q, inf;
int ne[100010][26];
int dp[260][260][260];
int now[4] = {};
string S, R[4];
int main() {
  cin >> N >> Q >> S;
  inf = N + 1;
  for (int i = 0; i <= N + 1; i++)
    for (int j = 0; j < 26; j++) ne[i][j] = inf;
  for (int i = N; i >= 1; i--) {
    for (int j = 0; j < 26; j++) {
      if (S[i - 1] - 'a' == j)
        ne[i - 1][j] = i;
      else
        ne[i - 1][j] = ne[i][j];
    }
  }
  for (int i = 0; i <= N + 1; i++) {
    for (int j = 0; j < 4; j++) {
      cerr << ne[i][j] << " ";
    }
    cerr << endl;
  }
  for (int i = 0; i <= 250; i++)
    for (int j = 0; j <= 250; j++)
      for (int k = 0; k <= 250; k++) dp[i][j][k] = inf;
  dp[0][0][0] = 0;
  char type, c;
  int r;
  for (int i = 0; i < Q; i++) {
    cin >> type;
    if (type == '+') {
      cin >> r >> c;
      R[r] += c;
      now[r]++;
      if (r == 1) {
        for (int j = 0; j <= now[2]; j++) {
          for (int k = 0; k <= now[3]; k++) {
            int a = ne[dp[now[r] - 1][j][k]][R[1][now[1] - 1] - 'a'];
            if (j > 0) a = min(a, ne[dp[now[r]][j - 1][k]][R[2][j - 1] - 'a']);
            if (k > 0) a = min(a, ne[dp[now[r]][j][k - 1]][R[3][k - 1] - 'a']);
            dp[now[r]][j][k] = a;
          }
        }
      } else if (r == 2) {
        for (int i = 0; i <= now[1]; i++) {
          for (int k = 0; k <= now[3]; k++) {
            int a = ne[dp[i][now[r] - 1][k]][R[2][now[2] - 1] - 'a'];
            if (i > 0) a = min(a, ne[dp[i - 1][now[r]][k]][R[1][i - 1] - 'a']);
            if (k > 0) a = min(a, ne[dp[i][now[r]][k - 1]][R[3][k - 1] - 'a']);
            dp[i][now[r]][k] = a;
          }
        }
      } else {
        for (int i = 0; i <= now[1]; i++) {
          for (int j = 0; j <= now[2]; j++) {
            int a = ne[dp[i][j][now[r] - 1]][R[3][now[3] - 1] - 'a'];
            if (i > 0) a = min(a, ne[dp[i - 1][j][now[r]]][R[1][i - 1] - 'a']);
            if (j > 0) a = min(a, ne[dp[i][j - 1][now[r]]][R[2][j - 1] - 'a']);
            dp[i][j][now[r]] = a;
          }
        }
      }
    } else {
      cin >> r;
      R[r].pop_back();
      now[r]--;
    }
    cout << (dp[now[1]][now[2]][now[3]] < N + 1 ? "YES" : "NO") << endl;
  }
}
