#include <bits/stdc++.h>
const int MAXN = 2000 + 5;
std::bitset<MAXN> a[MAXN];
bool b[MAXN], sol[MAXN];
int t[MAXN], n, m, k;
inline void Gauss() {
  int r = 1;
  for (int i = 1; i <= 2 * n && r <= m; ++i) {
    for (int j = r; j <= m; ++j) {
      if (a[j][i]) {
        std::swap(a[j], a[r]);
        std::swap(b[j], b[r]);
        break;
      }
    }
    if (!a[r][i]) continue;
    for (int j = r + 1; j <= m; ++j) {
      if (a[j][i]) {
        a[j] ^= a[r];
        b[j] ^= b[r];
      }
    }
    ++r;
  }
  for (int i = r; i <= m; ++i)
    if (b[i]) {
      puts("NO");
      exit(0);
    }
  for (int i = r - 1; i >= 1; --i) {
    int j = 1;
    while (j <= 2 * n && !a[i][j]) ++j;
    sol[j] = b[i];
    for (int k = j + 1; k <= 2 * n; ++k)
      if (a[i][k]) sol[j] ^= sol[k];
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) t[2 * i - 1] = 2, t[2 * i] = 1;
  for (int i = 1; i <= k; ++i) {
    char str[10];
    scanf("%s", str);
    int _;
    scanf("%d", &_);
    std::vector<int> S;
    while (_--) {
      int x;
      scanf("%d", &x);
      S.push_back(x);
    }
    if (str[0] == 'm') {
      scanf("%s", str);
      int col =
          (str[0] == 'R' ? 1 : (str[0] == 'Y' ? 2 : (str[0] == 'B' ? 3 : 0)));
      ++m;
      for (auto x : S) {
        a[m][2 * x - 1] = t[2 * x - 1] >> 1;
        a[m][2 * x] = t[2 * x - 1] & 1;
      }
      b[m] = col >> 1;
      ++m;
      for (auto x : S) {
        a[m][2 * x - 1] = t[2 * x] >> 1;
        a[m][2 * x] = t[2 * x] & 1;
      }
      b[m] = col & 1;
    }
    if (str[0] == 'R' && str[1] == 'Y') {
      for (auto x : S) std::swap(t[2 * x - 1], t[2 * x]);
    }
    if (str[0] == 'R' && str[1] == 'B') {
      for (auto x : S) t[2 * x - 1] ^= t[2 * x];
    }
    if (str[0] == 'Y' && str[1] == 'B') {
      for (auto x : S) t[2 * x] ^= t[2 * x - 1];
    }
  }
  Gauss();
  puts("YES");
  for (int i = 1; i <= n; ++i) {
    int col = (sol[2 * i - 1] << 1) | sol[2 * i];
    putchar(".RYB"[col]);
  }
  puts("");
  return 0;
}
