#include <bits/stdc++.h>
using namespace std;
int gauss(vector<bitset<4005>> a, int n, int m, bitset<4005>& ans) {
  vector<int> where(m, -1);
  for (int col = 0, row = 0; col < m && row < n; ++col) {
    for (int i = row; i < n; ++i)
      if (a[i][col]) {
        swap(a[i], a[row]);
        break;
      }
    if (!a[row][col]) continue;
    where[col] = row;
    for (int i = 0; i < n; ++i)
      if (i != row && a[i][col]) a[i] ^= a[row];
    ++row;
  }
  ans.reset();
  for (int i = 0; i < m; ++i)
    if (where[i] != -1) ans[i] = a[where[i]][m];
  for (int i = 0; i < n; ++i) {
    int sum = 0;
    for (int j = 0; j < m; ++j) sum ^= ans[j] * a[i][j];
    if (sum != a[i][m]) return 0;
  }
  for (int i = 0; i < m; ++i)
    if (where[i] == -1) return 1000000005;
  return 1;
}
vector<bitset<4005>> a;
bitset<4005> ans, temp;
int n, k, cnt, v[1005][4], q, first, w[2];
string s;
vector<int> p;
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) v[i][j] = j;
    temp.reset();
    for (int j = 0; j < 4; j++) temp[4 * i + v[i][j]] = 1;
    temp[4 * n] = 1;
    a.push_back(temp);
  }
  for (int i = 1; i <= k; i++) {
    cin >> s;
    if (s == "mix") {
      q++;
      cin >> cnt;
      p.clear();
      for (int j = 1; j <= cnt; j++) {
        cin >> first;
        first--;
        p.push_back(first);
      }
      cin >> s;
      if (s == "R")
        w[0] = 1, w[1] = 0;
      else if (s == "B")
        w[0] = 1, w[1] = 1;
      else if (s == "Y")
        w[0] = 0, w[1] = 1;
      else
        w[0] = 0, w[1] = 0;
      temp.reset();
      for (int first : p) {
        temp[4 * first + v[first][0]] = 1;
        temp[4 * first + v[first][1]] = 1;
      }
      temp[4 * n] = w[0];
      a.push_back(temp);
      temp.reset();
      for (int first : p) {
        temp[4 * first + v[first][2]] = 1;
        temp[4 * first + v[first][1]] = 1;
      }
      temp[4 * n] = w[1];
      a.push_back(temp);
    } else if (s == "RB") {
      cin >> cnt;
      for (int j = 0; j < cnt; j++) {
        cin >> first;
        first--;
        swap(v[first][0], v[first][1]);
      }
    } else if (s == "RY") {
      cin >> cnt;
      for (int j = 0; j < cnt; j++) {
        cin >> first;
        first--;
        swap(v[first][0], v[first][2]);
      }
    } else {
      cin >> cnt;
      for (int j = 0; j < cnt; j++) {
        cin >> first;
        first--;
        swap(v[first][1], v[first][2]);
      }
    }
  }
  if (gauss(a, n + 2 * q, 4 * n, ans) == 0) {
    cout << "NO";
  } else {
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
      int s = 0;
      for (int j = 0; j < 4; j++) s += ans[4 * i + j];
      if (s == 3) {
        for (int j = 0; j < 4; j++) ans[4 * i + j] = !ans[4 * i + j];
      }
      if (ans[4 * i])
        cout << "R";
      else if (ans[4 * i + 1])
        cout << "B";
      else if (ans[4 * i + 2])
        cout << "Y";
      else
        cout << ".";
    }
  }
}
