from sys import stdin input = stdin.readline for _ in range(int(input())): N = int(input()) S = input().rstrip("\n") cnt1, cnt2 = 0, 0 for s in S*2: if s == "0": cnt2 = 0 cnt1 += 1 elif s == "1": cnt1 = 0 cnt2 += 1 else: if cnt1 == 2: cnt2 = 1 cnt1 = 0 elif cnt2 == 2: cnt1 = 1 cnt2 = 0 else: cnt1, cnt2 = 0, 0 if max(cnt1, cnt2) == 3: print("No") break else: print("Yes")