#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int seed = 131;
int n, m, nex[30][MAXN], pos[30];
string opt, ch;
char str[MAXN];
int id, dp[260][260][260], cnt[4];
char s[4][300];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  cin >> (str + 1);
  for (int i = 0; i <= 25; i++) pos[i] = n + 1, nex[i][n + 1] = n + 1;
  for (int i = n; i >= 0; i--) {
    for (int j = 0; j <= 25; j++) nex[j][i] = pos[j];
    if (i >= 1) pos[str[i] - 'a'] = i;
  }
  for (int cas = 1; cas <= m; cas++) {
    cin >> opt >> id;
    if (opt == "+") {
      cin >> ch;
      ch[0] -= 'a';
      cnt[id]++;
      s[id][cnt[id]] = ch[0];
      if (id == 1) {
        for (int i = 0; i <= cnt[2]; i++) {
          for (int j = 0; j <= cnt[3]; j++) {
            dp[cnt[1]][i][j] = nex[ch[0]][dp[cnt[1] - 1][i][j]];
            if (i > 0)
              dp[cnt[1]][i][j] =
                  min(dp[cnt[1]][i][j], nex[s[2][i]][dp[cnt[1]][i - 1][j]]);
            if (j > 0)
              dp[cnt[1]][i][j] =
                  min(dp[cnt[1]][i][j], nex[s[3][j]][dp[cnt[1]][i][j - 1]]);
          }
        }
      } else if (id == 2) {
        for (int i = 0; i <= cnt[1]; i++) {
          for (int j = 0; j <= cnt[3]; j++) {
            dp[i][cnt[2]][j] = nex[ch[0]][dp[i][cnt[2] - 1][j]];
            if (i > 0)
              dp[i][cnt[2]][j] =
                  min(dp[i][cnt[2]][j], nex[s[1][i]][dp[i - 1][cnt[2]][j]]);
            if (j > 0)
              dp[i][cnt[2]][j] =
                  min(dp[i][cnt[2]][j], nex[s[3][j]][dp[i][cnt[2]][j - 1]]);
          }
        }
      } else if (id == 3) {
        for (int i = 0; i <= cnt[1]; i++) {
          for (int j = 0; j <= cnt[2]; j++) {
            dp[i][j][cnt[3]] = nex[ch[0]][dp[i][j][cnt[3] - 1]];
            if (i > 0)
              dp[i][j][cnt[3]] =
                  min(dp[i][j][cnt[3]], nex[s[1][i]][dp[i - 1][j][cnt[3]]]);
            if (j > 0)
              dp[i][j][cnt[3]] =
                  min(dp[i][j][cnt[3]], nex[s[2][j]][dp[i][j - 1][cnt[3]]]);
          }
        }
      }
    } else
      cnt[id]--;
    if (dp[cnt[1]][cnt[2]][cnt[3]] > n)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
