#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=998244353; const double PI=acos(-1); bool solve(int N,string S){ for(int t=0;t<2;t++){ for(int i=0;i<2*N;i++){ if(S[i%N]!='?' && (S[i%N]==S[(i+1)%N] && S[(i+2)%N]=='?')) { S[(i+2)%N]=(char)((1-(S[i%N]-'0'))+'0'); } } reverse(S.begin(),S.end()); } for(int i=0;i>T; for(int t=0;t>N; string S; cin>>S; bool flag=solve(N,S); cout<<(flag?"Yes":"No")<