def solve(): n = int(input()) A = list(map(int, input().split())) if sum(A) != n or 0 not in A: return False for b in range(2): x = b ok = True for a in A: x = a - (1 - x) if x < 0 or 2 <= x: ok = False break if x != b: ok = False if ok: return True return False for _ in range(int(input())): if solve(): print("Yes") else: print("No")