#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 2;
bitset<N> equa[N], value[N];
int ans[N], hehe[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, i, j, k, l, num = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    value[2 * i][2 * i] = 1;
    value[2 * i + 1][2 * i + 1] = 1;
  }
  for (i = 0; i < m; i++) {
    string s;
    char x;
    cin >> s;
    if (s == "mix") {
      cin >> j;
      for (k = 0; k < j; k++) {
        cin >> l;
        l--;
        equa[num] ^= value[2 * l];
        equa[num + 1] ^= value[2 * l + 1];
      }
      cin >> x;
      if (x == 'R') {
        ans[num + 1] = 1;
      }
      if (x == 'Y') {
        ans[num] = 1;
      }
      if (x == 'B') {
        ans[num] = ans[num + 1] = 1;
      }
      num += 2;
    }
    if (s == "RB") {
      cin >> j;
      for (k = 0; k < j; k++) {
        cin >> l;
        l--;
        value[2 * l] ^= value[2 * l + 1];
      }
    }
    if (s == "RY") {
      cin >> j;
      for (k = 0; k < j; k++) {
        cin >> l;
        l--;
        swap(value[2 * n], value[2 * l]);
        swap(value[2 * l], value[2 * l + 1]);
        swap(value[2 * l + 1], value[2 * n]);
      }
    }
    if (s == "YB") {
      cin >> j;
      for (k = 0; k < j; k++) {
        cin >> l;
        l--;
        value[2 * l + 1] ^= value[2 * l];
      }
    }
  }
  int now = -1;
  for (i = 0; i < 2 * n; i++) {
    for (j = now + 1; j < num; j++) {
      if (equa[j][i]) {
        now++;
        swap(equa[j], equa[now]);
        swap(ans[j], ans[now]);
        for (k = 0; k < num; k++) {
          if (equa[k][i] && k != now) {
            equa[k] ^= equa[now];
            ans[k] ^= ans[now];
          }
        }
        break;
      }
    }
  }
  for (i = now + 1; i < num; i++) {
    assert(!equa[i].count());
    if (ans[i] == 1) {
      cout << "NO";
      return 0;
    }
  }
  for (i = now; i > -1; i--) {
    for (j = 2 * n - 1; j > -1; j--) {
      if (equa[i][j]) {
        if (equa[i].count() == 1) {
          equa[i][j] = 0;
          hehe[j] = ans[i];
        } else {
          equa[i][j] = 0;
          for (k = j; k > -1; k--) {
            if (equa[i][k]) {
              break;
            }
          }
          for (l = 0; l < i; l++) {
            if (equa[l][k]) {
              equa[l] ^= equa[i];
              ans[l] ^= ans[i];
            }
          }
        }
      }
    }
  }
  cout << "YES\n";
  for (i = 0; i < n; i++) {
    if (hehe[2 * i] && hehe[2 * i + 1]) {
      cout << 'B';
    }
    if (hehe[2 * i] && !hehe[2 * i + 1]) {
      cout << 'Y';
    }
    if (!hehe[2 * i] && hehe[2 * i + 1]) {
      cout << 'R';
    }
    if (!hehe[2 * i] && !hehe[2 * i + 1]) {
      cout << '.';
    }
  }
}
