#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
const int maxn = 2e3 + 20;
int n, k;
bitset<maxn> f[maxn];
int vis[maxn];
bitset<maxn> tmp[2];
int trans[maxn][2][2];
int op[3][2][2];
inline void insert(bitset<maxn> x) {
  for (int i = (2 * n - 1), _end_ = (0); i >= _end_; i--)
    if (x[i]) {
      if (!vis[i]) {
        f[i] = x;
        vis[i] = 1;
        return;
      } else
        x ^= f[i];
    }
  if (x[2 * n]) puts("NO"), exit(0);
}
int id[maxn];
inline void init() {
  n = read();
  k = read();
  for (int i = (0), _end_ = (n); i <= _end_; i++)
    trans[i][0][0] = trans[i][1][1] = 1;
  op[0][1][0] = op[0][0][1] = 1;
  op[1][0][0] = op[1][1][0] = op[1][1][1] = 1;
  op[2][0][0] = op[2][0][1] = op[2][1][1] = 1;
  for (int i = (1), _end_ = (k); i <= _end_; i++) {
    string s;
    cin >> s;
    if (s != "mix") {
      int t = 0;
      if (s == "RB")
        t = 1;
      else if (s == "YB")
        t = 2;
      int num = read();
      while (num--) {
        int id = read();
        id--;
        static int tmp[2][2];
        memset(tmp, 0, sizeof(tmp));
        for (int a = (0), _end_ = (1); a <= _end_; a++)
          for (int b = (0), _end_ = (1); b <= _end_; b++)
            for (int c = (0), _end_ = (1); c <= _end_; c++)
              tmp[a][b] ^= op[t][a][c] & trans[id][c][b];
        for (int a = (0), _end_ = (1); a <= _end_; a++)
          for (int b = (0), _end_ = (1); b <= _end_; b++)
            trans[id][a][b] = tmp[a][b];
      }
    } else {
      int num = read();
      tmp[0].reset();
      tmp[1].reset();
      while (num--) {
        int id = read();
        id--;
        for (int op = (0), _end_ = (1); op <= _end_; op++) {
          for (int x = (0), _end_ = (1); x <= _end_; x++) {
            tmp[op][id << 1 | x] = trans[id][op][x];
          }
        }
      }
      char ch;
      cin >> ch;
      if (ch == 'R' || ch == 'B') tmp[0][n << 1] = 1;
      if (ch == 'Y' || ch == 'B') tmp[1][n << 1] = 1;
      insert(tmp[0]);
      insert(tmp[1]);
    }
  }
  for (int i = (0), _end_ = (2 * n - 1); i <= _end_; i++) {
    if (!vis[i])
      id[i] = 0;
    else {
      id[i] = f[i][2 * n];
      for (int j = (0), _end_ = (i - 1); j <= _end_; j++)
        if (f[i][j]) id[i] ^= f[i][j] & id[j];
    }
  }
  puts("YES");
  for (int i = (0), _end_ = (n - 1); i <= _end_; i++) {
    int a = id[i << 1], b = id[i << 1 | 1], t = a + b * 2;
    if (t == 0)
      printf(".");
    else if (t == 1)
      printf("R");
    else if (t == 2)
      printf("Y");
    else if (t == 3)
      printf("B");
  }
}
int main() {
  init();
  return 0;
}
