import sys from collections import deque, Counter input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 def solve(): n = ii() s = [-1 if v == '?' else int(v) for v in input()] p = [] for i in range(n): if s[i] == -1: p.append(i) p = list(set(p[:3] + p[-3:])) m = len(p) for bit in range(1 << m): a = s[::] for i in range(m): if 1 & (bit >> i): a[p[i]] = 1 else: a[p[i]] = 0 f = False for i in range(2, n): if a[i] == -1 and (a[i - 1] == 1 and a[i - 2] == 1): a[i] = 0 elif a[i] == -1: a[i] = 1 if a[i-2] == a[i-1] == a[i]: f = True break if f or a[-1] == a[0] == a[1] or a[-2] == a[-1] == a[0]: pass else: print('Yes') return print('No') for _ in range(ii()): solve()