#include #include using namespace std; namespace my{ #define eb emplace_back #define done(...) return pp(__VA_ARGS__) #define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__) #define RDVL(T,n,...) vec__VA_ARGS__;resizes({n},__VA_ARGS__);lin(__VA_ARGS__) #define VL(n,...) RDVL(ll,n,__VA_ARGS__) #define FO(n) for(ll ij=n;ij-->0;) #define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);i{}) #define base_operator(op,type) auto operator op(const type&v)const{auto copy=*this;return copy op##=v;} #define single_testcase void solve();}int main(){my::io();my::solve();}namespace my{ void io(){cerr<sync_with_stdio(0);cout<struct pair{ A a;B b; pair()=default; pair(A a,B b):a(a),b(b){} pair(const std::pair&p):a(p.first),b(p.second){} auto operator<=>(const pair&)const=default; pair operator+(const pair&p)const{return{a+p.a,b+p.b};} friend istream&operator>>(istream&i,pair&p){return i>>p.a>>p.b;} friend ostream&operator<<(ostream&o,const pair&p){return o<using pack_back_t=tuple_element_t>; templateconcept vectorial=is_base_of_v::value_type>,remove_cvref_t>; templateconstexpr int rank(){if constexpr(vectorial)return rank()+1;else return 0;} templatestruct core_t_helper{using core_t=T;}; templatestruct core_t_helper{using core_t=typename core_t_helper::core_t;}; templateusing core_t=core_t_helper::core_t; templateistream&operator>>(istream&i,vector&v){fe(v,e)i>>e;return i;} templateostream&operator<<(ostream&o,const vector&v){ll n=v.size();fo(i,n)o<?newline:space);return o;} templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=typename hvec_helper::type; templatestruct vec:vector{ static constexpr int R=rank>(); using C=core_t; using vector::vector; vec(const vector&v){vector::operator=(v);} vec(const auto&...a)requires(sizeof...(a)>=3){resizes(a...);} void resizes(const auto&...a){*this=make(a...);} static auto make(ll n,const auto&...a){if constexpr(sizeof...(a)==1)return vec(n,array{a...}[0]);else return vec(n,make(a...));} vec&operator^=(const vec&u){this->insert(this->end(),u.begin(),u.end());return*this;} vec&operator+=(const vec&u){vec&v=*this;assert(v.size()==u.size());fo(i,v.size())v[i]+=u[i];return v;} vec&operator-=(const vec&u){vec&v=*this;assert(v.size()==u.size());fo(i,v.size())v[i]-=u[i];return v;} base_operator(^,vec) base_operator(+,vec) base_operator(-,vec) vec&operator++(){fe(*this,e)++e;return*this;} vec&operator--(){fe(*this,e)--e;return*this;} ll size()const{return vector::size();} auto lower_bound(const V&x)const{return std::lower_bound(this->begin(),this->end(),x);} ll arg_lower_bound(const V&x)const{return lower_bound(x)-this->begin();} template>auto sort(F f={})const{vec v=*this;ranges::sort(v,f);return v;} auto flatten()const{if constexpr(!vectorial)return*this;else{vecres;fe(*this,e)res^=e.flatten();return res;}} auto unique()const{auto res=flatten().sort();sort(res).erase(ranges::unique(res).begin(),res.end());return res;} auto zip_impl(const vec&v)const{ hvecres;res.reserve(size()); fe(*this,e)if constexpr(vectorial)res.eb(e.zip_impl(v));else res.eb(v.arg_lower_bound(e)); return res; } auto zip()const{return zip_impl(unique());} }; templaterequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; vec(ll)->vec; templatevoid resizes(const array::R+1>&s,A&...a){(apply([&](const auto&...b){a.resizes(b...); },s),...);} void lin(auto&...a){(cin>>...>>a);} void pp(const auto&...a){ll n=sizeof...(a);((cout<0,space)),...);cout<>auto&sort(auto&a,F f={}){ranges::sort(a,f);return a;} auto&unique(auto&a){sort(a).erase(ranges::unique(a).begin(),a.end());return a;} auto zip(auto&...a){auto v=(a^...);unique(v);([&](auto&u){fe(u,e)e=v.arg_lower_bound(e);}(a),...);return v;} single_testcase void solve(){ LL(N,M); VL(N,a); VL(M,b); auto v=zip(a,b); ll C=v.size(); vec cnt(C,2,-1); fo(i,N)cnt[a[i]][0]=i; fo(i,M)cnt[b[i]][1]=i; vec>res; fo(i,C)if(cnt[i][0]!=-1&&cnt[i][1]==-1)res.eb(0,i); ll k=-1; fo(i,C){ if(cnt[i][0]!=-1&&cnt[i][1]!=-1){ res.eb(0,i); res.eb(1,i); k=i; break; } } if(N&&M&&k==-1)done(No()); fo(i,C)if(cnt[i][0]==-1&&cnt[i][1]!=-1)res.eb(1,i); ll r=1; fo(i,C)if(k!=i){ if(cnt[i][0]!=-1&&cnt[i][1]!=-1){ res.eb(r,i); res.eb(1-r,i); r=1-r; } } pp(Yes()); fe(res,e)pp((e.a==0?"Red":"Blue"),v[e.b]); }}