#include <bits/stdc++.h>
using namespace std;
char str[20];
map<char, int> mp;
int n, k;
int w[2][2001];
bitset<2001> cur[2];
bool have[2001];
bitset<2001> r[2001];
bool ok = true;
void ins(bitset<2001> v) {
  for (int i = 2 * n - 1; i >= 0; i--) {
    if (v[i]) {
      if (have[i])
        v ^= r[i];
      else {
        have[i] = true;
        r[i] = v;
        return;
      }
    }
  }
  if (v[2 * n]) ok = false;
}
int ans[2001];
int main() {
  mp['W'] = 0, mp['R'] = 1, mp['Y'] = 2, mp['B'] = 3;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) w[0][i] = 1, w[1][i] = 2;
  while (k--) {
    scanf(" %s", str);
    if (str[0] == 'm') {
      int m;
      scanf("%d", &m);
      for (int i = 0; i < 2; i++) cur[i].reset();
      while (m--) {
        int x;
        scanf("%d", &x);
        x--;
        for (int i = 0; i < 2; i++) {
          if (w[i][x] & 1) cur[i].set(x << 1);
          if (w[i][x] >> 1 & 1) cur[i].set(x << 1 | 1);
        }
      }
      char c;
      scanf(" %c", &c);
      int res = mp[c];
      if (res & 1) cur[0].set(2 * n);
      if (res >> 1 & 1) cur[1].set(2 * n);
      for (int i = 0; i < 2; i++) ins(cur[i]);
    } else if (str[0] == 'R' && str[1] == 'Y') {
      int m;
      scanf("%d", &m);
      while (m--) {
        int x;
        scanf("%d", &x);
        x--;
        swap(w[0][x], w[1][x]);
      }
    } else if (str[0] == 'R' && str[1] == 'B') {
      int m;
      scanf("%d", &m);
      while (m--) {
        int x;
        scanf("%d", &x);
        x--;
        w[1][x] ^= w[0][x];
      }
    } else if (str[0] == 'Y' && str[1] == 'B') {
      int m;
      scanf("%d", &m);
      while (m--) {
        int x;
        scanf("%d", &x);
        x--;
        w[0][x] ^= w[1][x];
      }
    }
  }
  if (ok == false) return printf("NO\n"), 0;
  for (int i = 0; i <= n * 2 - 1; i++) {
    if (r[i][i]) {
      ans[i] = r[i][n * 2];
      for (int j = i + 1; j <= n * 2 - 1; j++)
        if (r[j][i]) r[j] ^= r[i];
    }
  }
  printf("YES\n");
  auto gc = [&](int x) {
    if (x == 0) return '.';
    if (x == 1) return 'R';
    if (x == 2) return 'Y';
    if (x == 3) return 'B';
    assert(0);
  };
  for (int i = 0; i < n; i++) {
    int x = ans[i << 1] + ans[i << 1 | 1] * 2;
    printf("%c", gc(x));
  }
  return 0;
}
