#include <bits/stdc++.h>
using namespace std;
int dp[253][253][253];
int nx[100003][30];
char S[100003], s[5][253];
int main() {
  int n, m;
  char S[100003];
  char c[3];
  cin >> n >> m;
  scanf("%s", S + 1);
  for (int i = 0; i < 26; i++) {
    nx[n + 1][i] = nx[n][i] = n + 1;
    for (int j = n - 1; j >= 0; j--) {
      if (S[j + 1] == 'a' + i)
        nx[j][i] = j + 1;
      else
        nx[j][i] = nx[j + 1][i];
    }
  }
  s[1][0] = s[2][0] = s[3][0] = 'T';
  while (m--) {
    scanf("%s", c);
    if (c[0] == '+') {
      int x;
      scanf("%d%s", &x, c);
      s[x][strlen(s[x])] = c[0];
      if (x == 1) {
        int i = strlen(s[x]) - 1;
        for (int j = 0; j < strlen(s[2]); j++)
          for (int k = 0; k < strlen(s[3]); k++) {
            dp[i][j][k] = nx[dp[i - 1][j][k]][s[1][i] - 'a'];
            if (j)
              dp[i][j][k] =
                  min(dp[i][j][k], nx[dp[i][j - 1][k]][s[2][j] - 'a']);
            if (k)
              dp[i][j][k] =
                  min(dp[i][j][k], nx[dp[i][j][k - 1]][s[3][k] - 'a']);
          }
      }
      if (x == 2) {
        int i = strlen(s[x]) - 1;
        for (int j = 0; j < strlen(s[1]); j++)
          for (int k = 0; k < strlen(s[3]); k++) {
            dp[j][i][k] = nx[dp[j][i - 1][k]][s[2][i] - 'a'];
            if (j)
              dp[j][i][k] =
                  min(dp[j][i][k], nx[dp[j - 1][i][k]][s[1][j] - 'a']);
            if (k)
              dp[j][i][k] =
                  min(dp[j][i][k], nx[dp[j][i][k - 1]][s[3][k] - 'a']);
          }
      }
      if (x == 3) {
        int i = strlen(s[x]) - 1;
        for (int j = 0; j < strlen(s[1]); j++)
          for (int k = 0; k < strlen(s[2]); k++) {
            dp[j][k][i] = nx[dp[j][k][i - 1]][s[3][i] - 'a'];
            if (j)
              dp[j][k][i] =
                  min(dp[j][k][i], nx[dp[j - 1][k][i]][s[1][j] - 'a']);
            if (k)
              dp[j][k][i] =
                  min(dp[j][k][i], nx[dp[j][k - 1][i]][s[2][k] - 'a']);
          }
      }
    } else {
      int x;
      scanf("%d", &x);
      s[x][strlen(s[x]) - 1] = '\0';
    }
    if (dp[strlen(s[1]) - 1][strlen(s[2]) - 1][strlen(s[3]) - 1] > n)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
