#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0;
  bool flg = false;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flg = true;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return flg ? -x : x;
}
int n, m;
int c[1010][2][2];
bitset<2010> a[2010];
int b[2010];
int z[2010];
void gauss_init(int n) {
  bitset<2010> &c = a[0];
  int &d = b[0];
  for (int i(1); i <= int(n); i++)
    if (c[i]) {
      if (a[i][i]) {
        c ^= a[i], d ^= b[i];
        continue;
      }
      a[i] = c, b[i] = d;
      return;
    }
  if (d) puts("NO"), exit(0);
}
void gauss_calc(int n) {
  for (int i(n); i >= int(1); i--) {
    for (int j(i + 1); j <= int(n); j++) b[i] ^= z[j] * a[i][j];
    z[i] = b[i];
  }
}
int getid(char x) {
  if (x == 'W') return 0;
  if (x == 'R') return 1;
  if (x == 'Y') return 2;
  if (x == 'B') return 3;
  assert(0);
}
void solve() {
  n = read(), m = read();
  for (int i(1); i <= int(n); i++) c[i][0][0] = c[i][1][1] = 1;
  for (int _(1); _ <= int(m); _++) {
    char str[5];
    scanf("%s", str);
    int k = read();
    vector<int> S(k);
    for (int i(0); i <= int(k - 1); i++) S[i] = read();
    if (str[0] == 'm') {
      scanf("%s", str);
      int msk = getid(str[0]);
      a[0].reset(), b[0] = 0;
      for (int i(0); i <= int(k - 1); i++) {
        const auto f = c[S[i]];
        if (f[0][0]) a[0].flip(S[i]);
        if (f[0][1]) a[0].flip(S[i] + n);
      }
      b[0] = msk & 1;
      gauss_init(n << 1);
      a[0].reset(), b[0] = 0;
      for (int i(0); i <= int(k - 1); i++) {
        const auto f = c[S[i]];
        if (f[1][0]) a[0].flip(S[i]);
        if (f[1][1]) a[0].flip(S[i] + n);
      }
      b[0] = msk >> 1;
      gauss_init(n << 1);
    } else if (str[0] == 'R' && str[1] == 'Y') {
      for (int i(0); i <= int(k - 1); i++) swap(c[S[i]][0], c[S[i]][1]);
    } else if (str[0] == 'Y') {
      for (int i(0); i <= int(k - 1); i++) {
        const auto f = c[S[i]];
        for (int e(0); e <= int(1); e++) f[0][e] ^= f[1][e];
      }
    } else {
      for (int i(0); i <= int(k - 1); i++) {
        const auto f = c[S[i]];
        for (int e(0); e <= int(1); e++) f[1][e] ^= f[0][e];
      }
    }
  }
  gauss_calc(n << 1);
  puts("YES");
  for (int i(1); i <= int(n); i++) putchar(".RYB"[z[i] | z[i + n] << 1]);
  puts("");
}
int main() {
  for (int T = 1; T--;) solve();
  return 0;
}
