T = int(input()) def calc(N,S): t = [] for s in S: if s == "?": t.append(2) else: t.append(int(s)) for init in range(4): flag = True for i in range(2): if t[i] == 2 or t[i] == ((init >> (1 - i)) & 1): pass else: flag = False if flag == False: continue dat = [0] * 4 dat[init] = 1 for j in range(2,N): nx = [0] * 4 if t[j] == 2 or t[j] == 1: for bit in range(3): nx [((bit << 1) | 1) & 3] |= dat[bit] if t[j] == 2 or t[j] == 0: for bit in range(1,4): nx [(bit << 1) & 3] |= dat[bit] dat = nx for bit in range(4): if dat[bit]: flag = True tmp = (bit << 1) | (init >> 1) if tmp == 0 or tmp == 7: flag = False else: pass tmp = ((bit & 1) << 2) | init if tmp == 0 or tmp == 7: flag = False else: pass if flag: #print(bit,tmp,init) return True return False for _ in range(T): N = int(input()) S = input() print('Yes' if calc(N,S) else 'No')