#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int n, k, m;
bitset<2 * MAXN + 1> B[2 * MAXN];
bool a[2][2][MAXN];
bool taken[2 * MAXN];
int idx[2 * MAXN];
bool sol[2 * MAXN];
map<char, bool> M[2];
map<pair<bool, bool>, char> rev_M;
void make_equation(int i, int j, vector<int>& v, char result) {
  for (auto it : v) {
    B[i][2 * it + 0] = a[j][0][it];
    B[i][2 * it + 1] = a[j][1][it];
  }
  B[i][2 * n] = M[j][result];
}
void no() {
  cout << "NO\n";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  M[0]['W'] = 0;
  M[0]['R'] = 0;
  M[0]['B'] = 1;
  M[0]['Y'] = 1;
  M[1]['W'] = 0;
  M[1]['R'] = 1;
  M[1]['B'] = 0;
  M[1]['Y'] = 1;
  rev_M[{0, 0}] = '.';
  rev_M[{0, 1}] = 'R';
  rev_M[{1, 0}] = 'B';
  rev_M[{1, 1}] = 'Y';
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    a[0][0][i] = a[1][1][i] = 1;
    a[0][1][i] = a[1][0][i] = 0;
  }
  while (k--) {
    string name;
    int cnt;
    cin >> name >> cnt;
    vector<int> v(cnt);
    for (int i = 0; i < cnt; i++) {
      cin >> v[i];
      v[i]--;
    }
    if (name == "mix") {
      char result;
      cin >> result;
      make_equation(m + 0, 0, v, result);
      make_equation(m + 1, 1, v, result);
      m += 2;
    } else if (name == "RY") {
      for (auto it : v) {
        a[0][0][it] ^= a[1][0][it];
        a[0][1][it] ^= a[1][1][it];
      }
    } else if (name == "RB") {
      for (auto it : v) {
        swap(a[0][0][it], a[1][0][it]);
        swap(a[0][1][it], a[1][1][it]);
      }
    } else if (name == "YB") {
      for (auto it : v) {
        a[1][0][it] ^= a[0][0][it];
        a[1][1][it] ^= a[0][1][it];
      }
    }
  }
  for (int i = 0; i < 2 * n; i++) {
    idx[i] = -1;
    for (int j = 0; j < m; j++) {
      if (taken[j] || !B[j][i]) continue;
      if (idx[i] == -1) {
        idx[i] = j;
        taken[j] = true;
      } else {
        B[j] ^= B[idx[i]];
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if (B[i].count() == 1 && B[i][2 * n]) no();
  }
  for (int i = 2 * n - 1; i >= 0; i--) {
    if (idx[i] == -1) continue;
    sol[i] = B[idx[i]][2 * n];
    for (int j = i + 1; j < 2 * n; j++)
      if (B[idx[i]][j]) sol[i] ^= sol[j];
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    cout << rev_M[{sol[2 * i], sol[2 * i + 1]}];
  }
  cout << '\n';
  return 0;
}
