#include <bits/stdc++.h>
using namespace std;
bitset<2005> a[2005];
int pos[2005];
int ans[2005];
bool gause(int n, int m) {
  int d = 1;
  for (int i = 1; i <= n; i++) {
    if (!a[d][i]) {
      for (int j = d + 1; j <= m; j++)
        if (a[j][i]) {
          swap(a[d], a[j]);
          break;
        }
    }
    if (!a[d][i]) continue;
    pos[d] = i;
    for (int j = 1; j <= m; j++)
      if (j != d && a[j][i]) a[j] ^= a[d];
    d++;
  }
  for (int i = d; i <= m; i++)
    if (a[i][n + 1]) return 0;
  for (int i = 1; i < d; i++) ans[pos[i]] = a[i][n + 1];
  return 1;
}
bool num[1005][4];
int id[128], cur[1005];
const char *val = ".RYB";
int main() {
  id['W'] = 0;
  id['R'] = 1;
  id['Y'] = 2;
  id['B'] = 3;
  int n, m;
  scanf("%d%d", &n, &m);
  int sz = 0;
  for (int i = 1; i <= n; i++) num[i][0] = num[i][3] = 1;
  for (int i = 1; i <= m; i++) {
    char str[5];
    int k;
    scanf("%s%d", str, &k);
    for (int j = 1; j <= k; j++) scanf("%d", &cur[j]);
    if (str[0] == 'm') {
      scanf("%s", str);
      int v = id[str[0]];
      ++sz;
      for (int j = 1; j <= k; j++) {
        int x = cur[j];
        if (num[x][0]) a[sz].flip(2 * x - 1);
        if (num[x][1]) a[sz].flip(2 * x);
      }
      if (v & 1) a[sz].flip(2 * n + 1);
      ++sz;
      for (int j = 1; j <= k; j++) {
        int x = cur[j];
        if (num[x][2]) a[sz].flip(2 * x - 1);
        if (num[x][3]) a[sz].flip(2 * x);
      }
      if ((v >> 1) & 1) a[sz].flip(2 * n + 1);
    } else if (str[0] == 'R' && str[1] == 'Y') {
      for (int j = 1; j <= k; j++) {
        int x = cur[j];
        swap(num[x][0], num[x][2]);
        swap(num[x][1], num[x][3]);
      }
    } else if (str[0] == 'R' && str[1] == 'B') {
      for (int j = 1; j <= k; j++) {
        int x = cur[j];
        num[x][2] ^= num[x][0];
        num[x][3] ^= num[x][1];
      }
    } else {
      for (int j = 1; j <= k; j++) {
        int x = cur[j];
        num[x][0] ^= num[x][2];
        num[x][1] ^= num[x][3];
      }
    }
  }
  if (!gause(2 * n, sz)) {
    puts("NO");
    return 0;
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    int s = (ans[2 * i - 1] ^ (ans[2 * i] << 1));
    putchar(val[s]);
  }
  printf("\n");
  return 0;
}
