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("0") for i in range(len(S)): S[i]*=2 S[i] = "".join(S[i]) for i in range(len(S)): U[i] = S[i].replace("?","0") V[i] = S[i].replace("?","1") 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") elif (ans[i] == 0) and (U[i].find("000") == -1) and (V[i].find("111") == -1): print("Yes") else: print("No") if __name__ == "__main__": main()