import sys def solve(): t = int(sys.stdin.readline()) for _ in range(t): n = int(sys.stdin.readline()) a = list(map(int, sys.stdin.readline().split())) total = sum(a) if total % n != 0: print("NO") continue target = total // n s_odd = 0 for i in range(n): if i % 2 == 0: s_odd += a[i] if n % 2 == 0: if s_odd == total // 2: print("YES") else: print("NO") else: expected_odd = ((n + 1) // 2) * target if s_odd == expected_odd: print("YES") else: print("NO") solve()