#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
pair<int, int> gaussJordanBit(int n, int m, bitset<N> eq[N], bitset<N> &res) {
  int det = 1;
  vector<int> pos(m, -1);
  for (int i = 0, j = 0; i < n and j < m; ++j) {
    int piv = i;
    for (int k = i; k < n; ++k)
      if (eq[k][j]) {
        piv = k;
        break;
      }
    if (!eq[piv][j]) continue;
    pos[j] = i, swap(eq[piv], eq[i]), det &= eq[i][j];
    for (int k = 0; k < n; ++k)
      if (k ^ i and eq[k][j]) eq[k] ^= eq[i];
    ++i;
  }
  int free_var = 0;
  for (int i = 0; i < m; ++i) {
    pos[i] == -1 ? ++free_var, res[i] = det = 0 : res[i] = eq[pos[i]][m];
  }
  for (int i = 0; i < n; ++i) {
    int cur = eq[i][m];
    for (int j = 0; j < m; ++j) cur ^= eq[i][j] & res[j];
    if (cur) return make_pair(-1, det);
  }
  return make_pair(free_var, det);
}
bitset<N> eq[N], res;
int n, m, k, mat[N][2][2], cur[N];
int rb[2][2], ry[2][2], yb[2][2], tmp[2][2];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) mat[i][0][0] = mat[i][1][1] = 1;
  rb[0][0] = rb[0][1] = rb[1][1] = 1;
  ry[0][1] = ry[1][0] = 1;
  yb[0][0] = yb[1][0] = yb[1][1] = 1;
  while (k--) {
    string cmd;
    int sz;
    cin >> cmd >> sz;
    vector<int> ind(sz);
    for (auto &it : ind) scanf("%d", &it), --it;
    if (cmd == "mix") {
      char res;
      cin >> res;
      for (int i : ind) {
        if (mat[i][0][0]) eq[m][i << 1] = 1;
        if (mat[i][0][1]) eq[m][i << 1 | 1] = 1;
      }
      if (res == 'Y' or res == 'B') eq[m][n + n] = 1;
      ++m;
      for (int i : ind) {
        if (mat[i][1][0]) eq[m][i << 1] = 1;
        if (mat[i][1][1]) eq[m][i << 1 | 1] = 1;
      }
      if (res == 'R' or res == 'B') eq[m][n + n] = 1;
      ++m;
    } else if (cmd == "RB") {
      for (int p : ind) {
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            tmp[i][j] = mat[p][i][j];
          }
        }
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            mat[p][i][j] = 0;
            for (int x = 0; x < 2; ++x) {
              mat[p][i][j] ^= (rb[i][x] & tmp[x][j]);
            }
          }
        }
      }
    } else if (cmd == "RY") {
      for (int p : ind) {
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            tmp[i][j] = mat[p][i][j];
          }
        }
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            mat[p][i][j] = 0;
            for (int x = 0; x < 2; ++x) {
              mat[p][i][j] ^= (ry[i][x] & tmp[x][j]);
            }
          }
        }
      }
    } else {
      for (int p : ind) {
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            tmp[i][j] = mat[p][i][j];
          }
        }
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            mat[p][i][j] = 0;
            for (int x = 0; x < 2; ++x) {
              mat[p][i][j] ^= (yb[i][x] & tmp[x][j]);
            }
          }
        }
      }
    }
  }
  if (!m) {
    puts("YES");
    for (int i = 0; i < n; ++i) putchar('.');
    cout << '\n';
    return 0;
  }
  auto [free_var, det] = gaussJordanBit(m, n + n, eq, res);
  if (free_var == -1) {
    puts("NO");
    return 0;
  }
  puts("YES");
  string yo = ".RYB";
  for (int i = 0; i < n + n; i += 2) {
    int cur = res[i] << 1 | res[i + 1];
    putchar(yo[cur]);
  }
  cout << '\n';
  return 0;
}
