#include <bits/stdc++.h>
using namespace std;
const int N = 2003;
template <typename T>
void read(T &x) {
  int ch = getchar();
  x = 0;
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}
int n, m, k, a[N], b[N], ans[N];
bitset<N> bas[N];
void ins(bitset<N> val) {
  for (int i = 0; i < (n << 1); ++i)
    if (val[i]) {
      if (bas[i].none()) {
        bas[i] = val;
        return;
      }
      val ^= bas[i];
    }
  if (val[n << 1]) {
    puts("NO");
    exit(0);
  }
}
int ID(char x) {
  switch (x) {
    case 'R':
      return 1;
    case 'Y':
      return 2;
    case 'B':
      return 3;
    default:
      return 0;
  }
}
int main() {
  read(n);
  read(k);
  for (int i = 0; i < n; ++i) {
    a[i] = 1;
    b[i] = 2;
  }
  while (k--) {
    char opt[4], col[2];
    scanf("%s%d", opt, &m);
    if (opt[0] == 'm') {
      bitset<N> e1, e2;
      while (m--) {
        int x;
        read(x);
        --x;
        e1[x << 1] = a[x] & 1;
        e1[x << 1 | 1] = a[x] >> 1;
        e2[x << 1] = b[x] & 1;
        e2[x << 1 | 1] = b[x] >> 1;
      }
      scanf("%s", col);
      int id = ID(col[0]);
      e1[n << 1] = id & 1;
      e2[n << 1] = id >> 1;
      ins(e1);
      ins(e2);
    } else if (opt[0] == 'R' && opt[1] == 'Y') {
      while (m--) {
        int x;
        read(x);
        --x;
        swap(a[x], b[x]);
      }
    } else if (opt[0] == 'R' && opt[1] == 'B') {
      while (m--) {
        int x;
        read(x);
        --x;
        b[x] ^= a[x];
      }
    } else {
      while (m--) {
        int x;
        read(x);
        --x;
        a[x] ^= b[x];
      }
    }
  }
  for (int i = (n << 1) - 1; ~i; --i) {
    ans[i] = bas[i][n << 1];
    for (int j = i - 1; ~j; --j)
      if (bas[j][i]) bas[j] ^= bas[i];
  }
  puts("YES");
  for (int i = 0; i < n; ++i)
    putchar(".RYB"[ans[i << 1] | ans[i << 1 | 1] << 1]);
}
