def solve():
    n = int(input())
    dic = {"0":0,"1":1,"?":2}
    S = [dic[s] for s in input()]
    # print(S)
    for i in range(4):
        a = i//2
        b = i&1
        if S[0] != a and S[0] != 2:
            continue
        if S[1] != b and S[1] != 2:
            continue

        dp = [0]*4
        dp[i] = 1
        # print(i,dp,a,b)
        for s in range(2,n+2):
            if s < n:
                x = S[s]
            elif s == n:
                x = a
            else:
                x = b
        
            ndp = [0]*4
            for j in range(4):
                if dp[j] == 0:
                    continue
                if j == 0:
                    if x != 0:
                        ndp[(j*2+1)%4] = 1
                elif j == 3:
                    if x != 1:
                        ndp[(j*2)%4] = 1

                else:
                    if x != 0:
                        ndp[(j*2+1)%4] = 1
                    
                    if x != 1:
                        ndp[(j*2)%4] = 1
                
            dp = ndp
            # print(s,x,dp)
            if sum(dp) == 0:
                break
        
        if dp[i]:
            return "Yes"
    
    return "No"

t = int(input())
for _ in range(t):
    print(solve())