T=int(input()) for _ in range(T): n=int(input()) s=input() x=s[-2:]+s+s[:2] flag=1 S={"111","000","11?00","00?11"} for e in S: if e in x: flag=0 break print("Yes" if flag else "No")