import sys input = sys.stdin.readline T=int(input()) def judge(N,S): dp = [1]*8 def sub(dp, S): for s in S: dp2 = [0]*8 if s=="?": for i in range(4): dp2[i ] = dp[i<<1]|dp[(i<<1)+1] if i!=0 else 0 dp2[i+4] = dp[i<<1]|dp[(i<<1)+1] if i!=3 else 0 elif s=="0": for i in range(4): dp2[i ] = dp[i<<1]|dp[(i<<1)+1] if i!=0 else 0 else: for i in range(4): dp2[i+4] = dp[i<<1]|dp[(i<<1)+1] if i!=3 else 0 dp = dp2 return dp dp = sub(dp, S) dp = sub(dp, S) return sum(dp)>0 for _ in range(T): N=int(input()) S=input().strip() print("Yes" if judge(N,S) else "No")