#include using namespace std; using Int=long long; using Real=long double; templateinline bool chmin(T&A,S B){return(A>B?A=B,1:0);} templateinline bool chmax(T&A,S B){return(A>S[i]; bool ans=true; REP(i,3)REP(j,3) { ans=ans&&(i+1==3||S[i][j]!=S[i+1][j]); ans=ans&&(j+1==3||S[i][j]!=S[i][j+1]); } cout<<(ans?"Yes":"No")<<"\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<>T; while(T--)sol(); }