#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 1000;
int n, k, A[N_MAX][2][2];
int M[][2][2] = {{{0, 1}, {1, 0}}, {{1, 0}, {1, 1}}, {{1, 1}, {0, 1}}};
vector<bitset<2 * N_MAX + 1>> E;
bitset<2 * N_MAX> sol;
bool solve() {
  int r = 0, c = 0;
  while (r < E.size() && c < 2 * n) {
    int i = r;
    while (i < E.size() && E[i][c] == 0) i++;
    if (i == E.size()) {
      c++;
      continue;
    }
    swap(E[i], E[r]);
    for (i = 0; i < E.size(); i++)
      if (i != r && E[i][c]) E[i] ^= E[r];
    r++;
    c++;
  }
  for (int i = r; i < E.size(); i++)
    if (E[i][2 * n]) return false;
  sol = 0;
  for (int i = 0; i < r; i++) {
    int c = 0;
    while (E[i][c] == 0) c++;
    sol[c] = E[i][2 * n];
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) A[i][0][0] = A[i][1][1] = 1;
  while (k--) {
    string s;
    int m;
    cin >> s >> m;
    if (s == "mix") {
      int l = E.size();
      E.push_back(bitset<2 * N_MAX + 1>(0));
      E.push_back(bitset<2 * N_MAX + 1>(0));
      while (m--) {
        int j;
        cin >> j;
        j--;
        E[l][2 * j] = A[j][0][0];
        E[l][2 * j + 1] = A[j][0][1];
        E[l + 1][2 * j] = A[j][1][0];
        E[l + 1][2 * j + 1] = A[j][1][1];
      }
      char c;
      cin >> c;
      E[l][2 * n] = (c == 'R' || c == 'Y');
      E[l + 1][2 * n] = (c == 'B' || c == 'Y');
    } else {
      int x;
      if (s == "RB")
        x = 0;
      else if (s == "RY")
        x = 1;
      else
        x = 2;
      while (m--) {
        int j;
        cin >> j;
        j--;
        int B[2][2];
        for (int s = 0; s < 2; s++)
          for (int t = 0; t < 2; t++) B[s][t] = A[j][s][t];
        for (int s = 0; s < 2; s++) {
          for (int t = 0; t < 2; t++) {
            A[j][s][t] = 0;
            for (int u = 0; u < 2; u++) A[j][s][t] += M[x][s][u] * B[u][t];
            A[j][s][t] %= 2;
          }
        }
      }
    }
  }
  if (solve()) {
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
      if (sol[2 * i] && sol[2 * i + 1])
        cout << 'Y';
      else if (sol[2 * i])
        cout << 'R';
      else if (sol[2 * i + 1])
        cout << 'B';
      else
        cout << '.';
    }
    cout << '\n';
  } else
    cout << "NO\n";
  return 0;
}
