from sys import stdin input = stdin.readline for _ in range(int(input())): N = int(input()) S = input().rstrip("\n") S *= 2 dp = [False]*(1<<3) dp[0] = True for i in range(N*2): ndp = [False]*(1<<3) for bit in range(1<<3): if not dp[bit]: continue for j in range(2): if S[i] == "?" or int(S[i]) == j: ndp[(bit<<1)%(1<<3)+j] = True if 2 <= i: ndp[0], ndp[(1<<3)-1] = False, False dp = ndp print("Yes" if 1 <= sum(dp) else "No")