#include using namespace std; using ll=long long; using vl=vector; using vvl=vector>; using vvvl=vector>>; using pl=pair; using vpl=vector>; #define fi first #define se second #define all(x) (x).begin(),(x).end() #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=int(a);i using namespace atcoder; long long modpow(long long a, long long n, long long mo){long long res=1;while(n>0){if(n&1){res=res*a%mo;}a=a*a%mo;n>>=1;}return res;} long long Pow(long long a, long long n){long long res=1;while(n>0){if(n&1){res=res*a;}a=a*a;n>>=1;}return res;} const ll MOD=998244353; const ll INF=(1ll<<60); int main(){ ll T; cin>>T; rep(i,T){ ll N; cin>>N; string S; cin>>S; bool ans=true; rep(i,N){ if(S[i]==S[(i+1)%N] && S[i]==S[(i+2)%N] && S[i]!='?') ans=false; } rep(i,N){ if(S[i]==S[(i+1)%N] && S[(i+3)%N]==S[(i+4)%N] && S[i]!=S[(i+3)%N] && S[i]!='?' && S[(i+3)%N]!='?') ans=false; } if(ans) cout<<"Yes"<