#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const int MAXN = (int)1e5 + 5;
int n, q;
char s[MAXN];
int dp[255][255][255];
int help[MAXN][26];
string rel[4];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int i = 0; i < 26; i++) help[n + 1][i] = n + 1;
  for (int i = n + 1; i > 0; i--) {
    for (int j = 0; j < 26; j++) help[i - 1][j] = help[i][j];
    if (i != n + 1) help[i - 1][(int)(s[i] - 'a')] = i;
  }
  int i1 = 0, i2 = 0, i3 = 0;
  dp[0][0][0] = 0;
  while (q--) {
    char c;
    cin >> c;
    if (c == '+') {
      int a;
      char b;
      cin >> a >> b;
      rel[a].push_back(b);
      if (a == 1) {
        i1++;
        for (int j = 0; j <= i2; j++)
          for (int k = 0; k <= i3; k++)
            dp[i1][j][k] = help[dp[i1 - 1][j][k]][(int)(b - 'a')];
        for (int j = 0; j <= i2; j++)
          for (int k = 0; k <= i3; k++) {
            if (k != 0)
              dp[i1][j][k] =
                  min(dp[i1][j][k],
                      help[dp[i1][j][k - 1]][(int)(rel[3][k - 1] - 'a')]);
            if (j != 0)
              dp[i1][j][k] =
                  min(dp[i1][j][k],
                      help[dp[i1][j - 1][k]][(int)(rel[2][j - 1] - 'a')]);
          }
      } else if (a == 2) {
        i2++;
        for (int j = 0; j <= i1; j++)
          for (int k = 0; k <= i3; k++)
            dp[j][i2][k] = help[dp[j][i2 - 1][k]][(int)(b - 'a')];
        for (int j = 0; j <= i1; j++)
          for (int k = 0; k <= i3; k++) {
            if (k != 0)
              dp[j][i2][k] =
                  min(dp[j][i2][k],
                      help[dp[j][i2][k - 1]][(int)(rel[3][k - 1] - 'a')]);
            if (j != 0)
              dp[j][i2][k] =
                  min(dp[j][i2][k],
                      help[dp[j - 1][i2][k]][(int)(rel[1][j - 1] - 'a')]);
          }
      } else {
        i3++;
        for (int j = 0; j <= i1; j++)
          for (int k = 0; k <= i2; k++)
            dp[j][k][i3] = help[dp[j][k][i3 - 1]][(int)(b - 'a')];
        for (int j = 0; j <= i1; j++)
          for (int k = 0; k <= i2; k++) {
            if (k != 0)
              dp[j][k][i3] =
                  min(dp[j][k][i3],
                      help[dp[j][k - 1][i3]][(int)(rel[2][k - 1] - 'a')]);
            if (j != 0)
              dp[j][k][i3] =
                  min(dp[j][k][i3],
                      help[dp[j - 1][k][i3]][(int)(rel[1][j - 1] - 'a')]);
          }
      }
    } else {
      int a;
      cin >> a;
      rel[a].pop_back();
      if (a == 1)
        i1--;
      else if (a == 2)
        i2--;
      else
        i3--;
    }
    if (dp[i1][i2][i3] != n + 1)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
}
