#include <bits/stdc++.h>
int read() {
  static int c, x;
  while ((c = getchar()) < 48 || c > 57) {
  }
  x = c & 15;
  while ((c = getchar()) >= 48) x = x * 10 + (c & 15);
  return x;
}
int readalpha() {
  static int c;
  while ((c = getchar()) < 48) {
  }
  return c;
}
int lo[1010], hi[1010], fir[1010];
std::bitset<1010 << 1> a[1010 << 1];
bool ans[1010 << 1];
int main() {
  const int n = read(), N = n << 1;
  int m = read();
  for (int i = 1; i <= n; ++i) {
    lo[i] = 1;
    hi[i] = 2;
  }
  int cnt = 0;
  while (m--) {
    switch (readalpha()) {
      case 'm': {
        for (int t = read(); t--;) {
          const int x = read();
          if (lo[x] & 1) a[cnt + 1].set(x);
          if (lo[x] & 2) a[cnt + 1].set(x + n);
          if (hi[x] & 1) a[cnt + 2].set(x);
          if (hi[x] & 2) a[cnt + 2].set(x + n);
        }
        switch (readalpha()) {
          case 'R': {
            a[cnt + 1].set(N | 1);
            break;
          }
          case 'Y': {
            a[cnt + 2].set(N | 1);
            break;
          }
          case 'B': {
            a[cnt + 1].set(N | 1);
            a[cnt + 2].set(N | 1);
            break;
          }
        }
        cnt += 2;
        break;
      }
      case 'R': {
        if (readalpha() == 'Y') {
          for (int t = read(); t--;) {
            const int x = read();
            std::swap(lo[x], hi[x]);
          }
        } else {
          for (int t = read(); t--;) {
            const int x = read();
            hi[x] ^= lo[x];
          }
        }
        break;
      }
      case 'Y': {
        for (int t = read(); t--;) {
          const int x = read();
          lo[x] ^= hi[x];
        }
        break;
      }
    }
  }
  int i, r = 1;
  for (i = 1; i <= cnt && r <= N; ++r) {
    int p = i;
    while (p <= cnt && !a[p].test(r)) ++p;
    if (p > cnt) continue;
    if (p != i) std::swap(a[i], a[p]);
    for (int j = p + 1; j <= cnt; ++j) {
      if (a[j].test(r)) a[j] ^= a[i];
    }
    fir[i++] = r;
  }
  for (int j = i--; j <= cnt; ++j) {
    if (a[j].test(N | 1)) {
      puts("NO");
      return 0;
    }
  }
  for (int j = N; j; --j) {
    if (i && fir[i] == j) {
      bool res = a[i].test(N | 1);
      for (int k = j + 1; k <= N; ++k) {
        if (a[i].test(k)) res ^= ans[k];
      }
      ans[j] = res;
      --i;
    }
  }
  puts("YES");
  for (int i = 1; i <= n; ++i) {
    putchar(".RYB"[ans[i + n] << 1 | ans[i]]);
  }
  return 0;
}
