#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int m, k, pos[N], n;
bitset<N> a[N];
char op[20];
bitset<N> solve(int n, int m) {
  int now = 1;
  for (int i = 1; i <= m; i++) {
    bool fl = 1;
    if (!a[now][i]) {
      fl = 0;
      for (int j = now + 1; j <= n; j++)
        if (a[j][i]) {
          swap(a[now], a[j]);
          fl = 1;
          break;
        }
    }
    if (!fl) continue;
    pos[i] = now;
    for (int j = 1; j <= n; j++)
      if (now != j && a[j][i]) a[j] ^= a[now];
    ++now;
  }
  for (int i = 1; i <= n; i++)
    if (a[i].count() == 1 && a[i][m + 1] == 1) {
      cout << "NO";
      exit(0);
    }
  bitset<N> ret;
  for (int i = 1; i <= m; i++)
    if (pos[i]) ret[i] = a[pos[i]][m + 1];
  return ret;
}
struct dat {
  int s0, s1;
  dat() {
    s0 = 1;
    s1 = 2;
  }
  void trans(int op) {
    int t0, t1;
    if (op == 2)
      t0 = s1, t1 = s0;
    else if (op == 3)
      t0 = s0, t1 = s0 ^ s1;
    else
      t0 = s0 ^ s1, t1 = s1;
    s0 = t0;
    s1 = t1;
  }
} f[N];
int main() {
  cin >> m >> k;
  int n = 0;
  while (k--) {
    scanf("%s", op);
    if (op[0] == 'm') {
      int cnt = gi();
      while (cnt--) {
        int pos = gi();
        a[n + 1][pos] = f[pos].s0 & 1;
        a[n + 1][pos + m] = f[pos].s0 >> 1;
        a[n + 2][pos] = f[pos].s1 & 1;
        a[n + 2][pos + m] = f[pos].s1 >> 1;
      }
      scanf("%s", op);
      int tmp;
      if (op[0] == 'W')
        tmp = 0;
      else if (op[0] == 'R')
        tmp = 1;
      else if (op[0] == 'Y')
        tmp = 2;
      else
        tmp = 3;
      a[n + 1][m + m + 1] = tmp & 1;
      a[n + 2][m + m + 1] = tmp >> 1;
      n += 2;
    } else {
      int tmp;
      if (op[0] == 'R' && op[1] == 'Y')
        tmp = 2;
      else if (op[0] == 'R' && op[1] == 'B')
        tmp = 3;
      else
        tmp = 4;
      int cnt = gi();
      while (cnt--) f[gi()].trans(tmp);
    }
  }
  bitset<N> ans = solve(n, m + m);
  cout << "YES\n";
  for (int i = 1; i <= m; i++) {
    int tmp = ans[i] | (ans[i + m] << 1);
    cout << ".RYB"[tmp];
  }
  return 0;
}
