for _ in range(int(input())): n=int(input()) s=input() if n%2==0 or ("0 0" in s) or ("1 1" in s): print("Yes") else: print("No")