def solve(): n=int(input()) s=list(input()) inf=10**9 for i in range(3): if s[i]!='0' and s[i-1]!='1': t=s[i:]+s[:i] dp=[1,inf] for j in range(1,n): ndp=[inf,inf] if t[j]=='0' or t[j]=='?': ndp[0]=dp[0]+1 if dp[1]<3: ndp[0]=1 if t[j]=='1' or t[j]=='?': ndp[1]=dp[1]+1 if dp[0]<3: ndp[1]=1 dp=ndp if dp[1]<3: print('Yes') return print('No') for _ in range(int(input())): solve()