#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int n, K, N;
bitset<maxn * 2> F[maxn << 1];
struct node {
  mutable bool a[2][2];
  node() {
    a[0][1] = a[1][0] = 0;
    a[0][0] = a[1][1] = 1;
  }
  void change2() {
    for (int i = 0; i <= 1; i++) swap(a[0][i], a[1][i]);
  }
  void change3() {
    for (int i = 0; i <= 1; i++) a[0][i] ^= a[1][i];
  }
  void change4() {
    for (int i = 0; i <= 1; i++) a[1][i] ^= a[0][i];
  }
} A[maxn];
int pos[maxn << 1];
void Gauss() {
  for (int i = 1, j = 1; i <= n * 2 && j <= N; i++) {
    if (!F[j][i]) {
      int k = j + 1;
      for (; k <= N && !F[k][i]; k++)
        ;
      if (k > N) continue;
      swap(F[j], F[k]);
    }
    pos[i] = j;
    for (int k = 1; k <= N; k++) {
      if (j == k) continue;
      if (F[k][i]) F[k] ^= F[j];
    }
    j++;
  }
  for (int i = 1; i <= N; i++) {
    int flag = 0;
    for (int j = 1; j <= n * 2; j++) flag |= F[i][j];
    if (!flag && F[i][n * 2 + 1]) {
      puts("NO");
      exit(0);
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    int a = F[pos[i * 2 - 1]][n * 2 + 1], b = F[pos[i * 2]][n * 2 + 1];
    if (a == 0 && b == 0) putchar('.');
    if (a == 0 && b == 1) putchar('R');
    if (a == 1 && b == 0) putchar('Y');
    if (a == 1 && b == 1) putchar('B');
  }
  puts("");
}
int main() {
  scanf("%d%d", &n, &K);
  char s[10], c;
  for (int i = 1, x, y; i <= K; i++) {
    scanf("%s%d", s + 1, &y);
    if (s[1] == 'm') {
      for (int j = 1; j <= y; j++) {
        scanf("%d", &x);
        for (int k = 0; k <= 1; k++)
          for (int l = 0; l <= 1; l++)
            F[N + 1 + k][x * 2 - 1 + l] =
                F[N + 1 + k][x * 2 - 1 + l] ^ A[x].a[k][l];
      }
      for (c = getchar(); !isalpha(c); c = getchar())
        ;
      F[N + 1][n * 2 + 1] = (c == 'Y' || c == 'B');
      F[N + 2][n * 2 + 1] = (c == 'R' || c == 'B');
      N += 2;
    }
    if (s[1] == 'R' && s[2] == 'Y') {
      for (int j = 1; j <= y; j++) scanf("%d", &x), A[x].change2();
    }
    if (s[1] == 'R' && s[2] == 'B') {
      for (int j = 1; j <= y; j++) scanf("%d", &x), A[x].change3();
    }
    if (s[1] == 'Y' && s[2] == 'B') {
      for (int j = 1; j <= y; j++) scanf("%d", &x), A[x].change4();
    }
  }
  Gauss();
  return 0;
}
