#include using namespace std; using ll =long long; #include using namespace atcoder; void solve(){ vector> A={{"gray","brown","green","cyan","blue","yellow","orange","red"},{ "gray","green","blue","yellow","red"},{ "gray","green","cyan","blue","violet","orange","red"}}; vector S(3); cin>>S[0]>>S[1]>>S[2]; ll cnt=0; vector P={0,1,2}; set> Q; do{ bool OK=1; if(Q.count({S[P[0]],S[P[1]],S[P[2]]}))continue; Q.insert({S[P[0]],S[P[1]],S[P[2]]}); for(int i=0;i<3;i++){ bool E=0; for(auto s:A[i])if(s==S[P[i]])E=1; if(!E)OK=0; } if(OK)cnt++; }while(next_permutation(P.begin(),P.end())); cout<<(cnt==1?"Yes":"No")<>T; while(T--)solve(); }