def getInt(): return int(input()) def getList(): return list(input().split()) def main(): T = getInt() N = list() S = list() U = list() V = list() ans = [0 for i in range(T)] for i in range(T): N.append(getInt()) S.append(getList()) U.append("0") V.append("1") # print(N) # print(S) for i in range(len(S)): S[i]*=2 S[i] = "".join(S[i]) # print(S) for i in range(len(S)): U[i] = S[i].replace("?","0") V[i] = S[i].replace("?","1") # print(U) # print(V) for i in range(len(S)): if S[i].find("?") != -1: ans[i] = 1 for i in range(len(S)): if ((U[i].find("000") == -1 )or (V[i].find("111") == -1)) and (ans[i] == 1): print("Yes") else: print("No") if __name__ == "__main__": main()