#include <bits/stdc++.h>
using namespace std;
int aux[28][400000];
int dp[253][253][253];
string words[5];
int main() {
  int n, q;
  cin >> n >> q;
  string word;
  cin >> word;
  for (int i = n + 2; i >= 0; i--) {
    for (int j = 0; j < 26; j++) {
      if (i >= n)
        aux[j][i] = n;
      else
        aux[j][i] = (word[i] - 'a') == j ? i : aux[j][i + 1];
    }
  }
  memset(dp, -1, sizeof dp);
  char tipo, l;
  int idx;
  int a = 0, b = 0, c = 0;
  while (q--) {
    cin >> tipo;
    if (tipo == '+') {
      cin >> idx >> l;
      words[idx] += l;
      if (idx == 1)
        a++;
      else if (idx == 2)
        b++;
      else
        c++;
      if (idx == 1) {
        for (int i = 0; i <= words[2].size(); i++) {
          for (int j = 0; j <= words[3].size(); j++) {
            int mini = aux[words[idx][a - 1] - 'a'][dp[a - 1][i][j] + 1];
            if (i)
              mini = min(mini, aux[words[2][i - 1] - 'a'][dp[a][i - 1][j] + 1]);
            if (j)
              mini = min(mini, aux[words[3][j - 1] - 'a'][dp[a][i][j - 1] + 1]);
            dp[a][i][j] = mini;
          }
        }
      } else if (idx == 2) {
        for (int i = 0; i <= words[1].size(); i++) {
          for (int j = 0; j <= words[3].size(); j++) {
            int mini = aux[words[idx][b - 1] - 'a'][dp[i][b - 1][j] + 1];
            if (i)
              mini = min(mini, aux[words[1][i - 1] - 'a'][dp[i - 1][b][j] + 1]);
            if (j)
              mini = min(mini, aux[words[3][j - 1] - 'a'][dp[i][b][j - 1] + 1]);
            dp[i][b][j] = mini;
          }
        }
      } else {
        for (int i = 0; i <= words[1].size(); i++) {
          for (int j = 0; j <= words[2].size(); j++) {
            int mini = aux[words[idx][c - 1] - 'a'][dp[i][j][c - 1] + 1];
            if (i)
              mini = min(mini, aux[words[1][i - 1] - 'a'][dp[i - 1][j][c] + 1]);
            if (j)
              mini = min(mini, aux[words[2][j - 1] - 'a'][dp[i][j - 1][c] + 1]);
            dp[i][j][c] = mini;
          }
        }
      }
      printf("%s\n", dp[a][b][c] < n ? "YES" : "NO");
    } else {
      cin >> idx;
      if (idx == 1)
        a--;
      else if (idx == 2)
        b--;
      else
        c--;
      words[idx].pop_back();
      printf("%s\n", dp[a][b][c] < n ? "YES" : "NO");
    }
  }
  return 0;
}
