#include <bits/stdc++.h>
using namespace std;
bitset<2005> s[2005], c[2005];
int ans[2005];
int main() {
  ios::sync_with_stdio(0);
  int n, m, q, x, cnt = 0;
  string op;
  char ch;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) s[i].set(i), s[i + n].set(i + n);
  while (q--) {
    cin >> op >> m;
    if (op == "mix") {
      cnt += 2;
      while (m--) cin >> x, c[cnt - 1] ^= s[x], c[cnt] ^= s[x + n];
      cin >> ch;
      if (ch == 'R' || ch == 'B') c[cnt - 1].set(2 * n + 1);
      if (ch == 'Y' || ch == 'B') c[cnt].set(2 * n + 1);
    } else if (op == "RY") {
      while (m--) cin >> x, swap(s[x], s[x + n]);
    } else if (op == "RB") {
      while (m--) cin >> x, s[x + n] ^= s[x];
    } else {
      while (m--) cin >> x, s[x] ^= s[x + n];
    }
  }
  int now = 0;
  for (int i = 1; i <= cnt; i++) {
    if (i + now == 2 * n + 1) break;
    if (!c[i][i + now]) {
      for (int j = i + 1; j <= cnt; j++)
        if (c[j][i + now]) {
          swap(c[i], c[j]);
          break;
        }
      if ((!c[i][i + now])) {
        now++, i--;
        continue;
      }
    }
    for (int j = 1; j <= cnt; j++)
      if (j != i && c[j][i + now]) c[j] ^= c[i];
  }
  for (int i = 1; i <= cnt; i++) {
    int t = 0;
    for (int j = 1; j <= 2 * n; j++)
      if (c[i][j]) {
        t = j;
        break;
      }
    if ((!t) && c[i][2 * n + 1]) {
      puts("NO");
      return 0;
    }
    ans[t] = c[i][2 * n + 1];
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    int t = ans[i] + (ans[i + n] << 1);
    putchar(".RYB"[t]);
  }
  return 0;
}
