#include <bits/stdc++.h>
using namespace std;
template <class IT>
inline void cmax(IT &a, IT b) {
  if (a < b) a = b;
}
template <class IT>
inline void cmin(IT &a, IT b) {
  if (b < a) a = b;
}
template <class IT>
inline bool bmax(IT &a, IT b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class IT>
inline bool bmin(IT &a, IT b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
const int N = 1005, M = N << 1;
bitset<M> B[M], L, R;
int K[M], A[N];
inline void add(bitset<M> &b, int k, int x) {
  int i;
  for (i = (0); i < (x); ++i)
    if (b.test(i)) {
      if (B[i].test(i)) {
        b ^= B[i];
        k ^= K[i];
      } else {
        B[i] = b;
        K[i] = k;
        return;
      }
    }
  if (k) {
    cout << "NO";
    exit(0);
  }
}
inline void ac() {
  int x, n, m, q, a, i;
  string mode;
  cin >> n >> q;
  x = n << 1;
  for (i = (0); i < (n); ++i) A[i] = 9;
  while (q--) {
    cin >> mode >> m;
    if (mode == "mix") {
      L.reset();
      R.reset();
      while (m--) {
        cin >> a;
        --a;
        if (A[a] & 8) L.set(a << 1);
        if (A[a] & 4) L.set(a << 1 | 1);
        if (A[a] & 2) R.set(a << 1);
        if (A[a] & 1) R.set(a << 1 | 1);
      }
      cin >> mode;
      add(L, mode == "R" || mode == "Y", x);
      add(R, mode == "B" || mode == "Y", x);
    } else {
      while (m--) {
        cin >> a;
        --a;
        if (mode == "RY")
          A[a] ^= A[a] >> 2;
        else if (mode == "YB") {
          A[a] ^= A[a] << 2;
          A[a] &= 15;
        } else {
          A[a] ^= A[a] >> 2;
          A[a] ^= A[a] << 2;
          A[a] &= 15;
          A[a] ^= A[a] >> 2;
        }
      }
    }
  }
  for (i = (x - 1); i >= (0); --i)
    if (B[i].test(i))
      for (a = (i + 1); a < (x); ++a)
        if (B[i].test(a) && B[a].test(a)) {
          B[i] ^= B[a];
          K[i] ^= K[a];
        }
  cout << "YES\n";
  for (i = (0); i < (n); ++i) {
    if (K[i << 1]) {
      if (K[i << 1 | 1])
        cout << "Y";
      else
        cout << "R";
    } else {
      if (K[i << 1 | 1])
        cout << "B";
      else
        cout << ".";
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ac();
  return 0;
}
