n = int(input()) for i in range(n): t = int(input()) a = list(map(int,input().split())) if sum(a) == t//2 and t % 2 == 0: print("Yes") continue mae = -1 if sum(a) < t//2: mokuteki = 0 else: mokuteki = 1 count = 0 for ipp in range(t): if a[ipp] == mae and a[ipp] == mokuteki: count += 1 print(count) else: mae = a[ipp] if abs((t-sum(a))-sum(a)) <= count: print("Yes") else: print("No")