#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

int main(){
	
	int _t;
	cin>>_t;
	rep(_,_t){
		int n;
		cin>>n;
		string s;
		cin>>s;
		bool f = false;
		rep(i,2){
			rep(j,2){
				if(s[0]!='?'&&s[0]!='0'+i)continue;
				if(s[1]!='?'&&s[1]!='0'+j)continue;
				vector dp(2,vector<int>(2,0));
				dp[i][j] = 1;
				for(int k=2;k<n;k++){
					vector ndp(2,vector<int>(2,0));
					rep(ii,2){
						rep(jj,2){
							if(dp[ii][jj]){
								rep(kk,2){
									if(s[k]!='?'&&s[k]!='0'+kk)continue;
									if(ii==jj&&ii==kk)continue;
									ndp[jj][kk] = 1;
								}
							}
						}
					}
					swap(dp,ndp);
				}
				rep(k,2){
					rep(l,2){
						if(dp[k][l]){
							if(k==l&&k==i)continue;
							if(l==i&&l==j)continue;
							f = true;
						}
					}
				}
			}
		}
		if(f)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	
	return 0;
}