#include <bits/stdc++.h>   template <typename T>   inline void read(T &x) {     x = 0;     char c = getchar();     bool flag = false;     while (!isdigit(c)) {       if (c ==  - ) flag = true;       c = getchar();     }     while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();     if (flag) x = -x;   }   using namespace std;   int n, q, nn;   bitset<2011> bt[1011][2], h[2011];   int htot;   int ans[2011], pos[2011];   inline void Gauss() {     int nw = 1;     for (int i = 1; i < nn; ++i) {       int id = -1;       for (int hang = nw; hang <= htot; ++hang)         if (h[hang][i]) {           id = hang;           break;         }       if (id == -1) continue;       swap(h[id], h[nw]);       pos[i] = nw;       for (int hang = 1; hang <= htot; ++hang)         if (hang != nw && h[hang][i]) {           h[hang] = h[hang] ^ h[nw];         }       ++nw;       if (nw > htot) break;     }     for (int i = 1; i <= htot; ++i)       if (h[i][nn]) {         bool flag = false;         for (int j = 1; j < nn; ++j)           if (h[i][j]) {             flag = true;             break;           }         if (!flag) {           puts( NO );           exit(0);         }       }     for (int i = 1; i < nn; ++i) {       ans[i] = h[pos[i]][nn];     }     puts( YES );     for (int i = 1; i <= n; ++i) {       if (ans[i] == 0 && ans[i + n] == 0)         putchar( . );       else if (ans[i] == 1 && ans[i + n] == 0)         putchar( R );       else if (ans[i] == 0 && ans[i + n] == 1)         putchar( B );       else         putchar( Y );     }     putchar(  n );   }   int main() {     read(n), read(q);     nn = n + n + 1;     for (int i = 1; i <= n; ++i) bt[i][0][i] = bt[i][1][i + n] = 1;     for (int i = 1; i <= q; ++i) {       char opt[6];       scanf( %s , opt);       if (opt[0] ==  m ) {         int k;         read(k);         htot += 2;         for (int j = 1; j <= k; ++j) {           int p;           read(p);           h[htot - 1] ^= bt[p][0];           h[htot] ^= bt[p][1];         }         char res[3];         scanf( %s , res);         if (res[0] ==  W )           h[htot - 1][nn] = 0, h[htot][nn] = 0;         else if (res[0] ==  R )           h[htot - 1][nn] = 1, h[htot][nn] = 0;         else if (res[0] ==  B )           h[htot - 1][nn] = 0, h[htot][nn] = 1;         else           h[htot - 1][nn] = 1, h[htot][nn] = 1;       } else if (opt[0] ==  R  && opt[1] ==  Y ) {         int k;         read(k);         for (int j = 1; j <= k; ++j) {           int p;           read(p);           bt[p][1] = bt[p][1] ^ bt[p][0];         }       } else if (opt[0] ==  R  && opt[1] ==  B ) {         int k;         read(k);         for (int j = 1; j <= k; ++j) {           int p;           read(p);           swap(bt[p][0], bt[p][1]);         }       } else if (opt[0] ==  Y  && opt[1] ==  B ) {         int k;         read(k);         for (int j = 1; j <= k; ++j) {           int p;           read(p);           bt[p][0] = bt[p][0] ^ bt[p][1];         }       }     }     Gauss();     return 0;   }   