You are given some Tetris field consisting of $n$ columns. The initial height of the $i$-th column of the field is $a_i$ blocks. On top of these columns you can place only figures of size $2 \times 1$ (i.e. the height of this figure is $2$ blocks and the width of this figure is $1$ block). Note that you cannot rotate these figures.

Your task is to say if you can clear the whole field by placing such figures.

More formally, the problem can be described like this:

The following process occurs while at least one $a_i$ is greater than $0$:  You place one figure $2 \times 1$ (choose some $i$ from $1$ to $n$ and replace $a_i$ with $a_i + 2$);  then, while all $a_i$ are greater than zero, replace each $a_i$ with $a_i - 1$. 

And your task is to determine if it is possible to clear the whole field (i.e. finish the described process), choosing the places for new figures properly.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

The next $2t$ lines describe test cases. The first line of the test case contains one integer $n$ ($1 \le n \le 100$) — the number of columns in the Tetris field. The second line of the test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 100$), where $a_i$ is the initial height of the $i$-th column of the Tetris field.


-----Output-----

For each test case, print the answer — "YES" (without quotes) if you can clear the whole Tetris field and "NO" otherwise.


-----Example-----
Input
4
3
1 1 3
4
1 1 2 1
2
11 11
1
100

Output
YES
NO
YES
YES



-----Note-----

The first test case of the example field is shown below:

[Image]

Gray lines are bounds of the Tetris field. Note that the field has no upper bound.

One of the correct answers is to first place the figure in the first column. Then after the second step of the process, the field becomes $[2, 0, 2]$. Then place the figure in the second column and after the second step of the process, the field becomes $[0, 0, 0]$.

And the second test case of the example field is shown below:

$\square$

It can be shown that you cannot do anything to end the process.

In the third test case of the example, you first place the figure in the second column after the second step of the process, the field becomes $[0, 2]$. Then place the figure in the first column and after the second step of the process, the field becomes $[0, 0]$.

In the fourth test case of the example, place the figure in the first column, then the field becomes $[102]$ after the first step of the process, and then the field becomes $[0]$ after the second step of the process.

Difficulty: EASY
Tags: Number theory

Implementation

Starter code:

Solutions:
T = int(input())
for _ in range(T):
	col = int(input())
	field = [int(x) for x in input().split()]
	remainder = field[0] % 2
	valid = True
	if col == 1:
		print('YES')
	else:
		for i in range(1, col):
			if remainder != field[i] % 2:
				valid = False
				break
		if valid:
			print('YES')
		else:
			print('NO')


e = int(input())
p = []
for ee in range(e):
	gg = 0
	g = 0
	n = int(input())
	a = [int(i) for i in input().split(' ', n - 1)]
	for i in range(n):
		if a[i] % 2 == 0:
			if g == 2:
				gg = 1
				break
			g = 1
		else:
			if g == 1:
				gg = 1
				break
			g = 2
	if gg == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
M = []

def fonction(L):
	L.sort()
	i = 0
	test = True
	while test == True and i <= n - 1:
		test = (max(L) - L[i]) % 2 == 0
		i += 1
	if test == False:
		return 'NO'
	else:
		return 'YES'
for i in range(t):
	n = int(input())
	L = [int(x) for x in input().split()]
	M.append(fonction(L))
for k in M:
	print(k)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = max(a)
	flag = True
	for e in a:
		if e % 2 != b % 2:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	tet = list(map(int, input().split()))
	tet_tmp = []
	for i in tet:
		tet_tmp.append(i % 2)
	if tet_tmp[1:].__contains__(abs(tet_tmp[0] - 1)):
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	for i in a:
		if i % 2 == 0:
			c1 += 1
		else:
			c2 += 1
	if c1 == n or c2 == n:
		print('YES')
	else:
		print('NO')


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	n = inp()
	a = inlt()
	a.sort()
	q = 'YES'
	for i in range(len(a) - 1):
		if (a[i + 1] - a[i]) % 2 != 0:
			q = 'NO'
			break
	print(q)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z = 1
	if a[0] % 2 == 0:
		for j in range(1, n):
			if a[j] % 2 != 0:
				z = 0
	else:
		for j in range(1, n):
			if a[j] % 2 == 0:
				z = 0
	if z:
		print('YES')
	else:
		print('NO')


t = int(input())
for c in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	mod = a[0] % 2
	for i in range(1, n):
		if mod ^ a[i] % 2:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.buffer.readline
t = int(input())
for i in range(t):
	n = int(input())
	data = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
		continue
	for j in range(1, len(data)):
		if (data[j] - data[j - 1]) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split(' ')))
	for i in range(n):
		if (max(a) - a[i]) % 2 == 0 or max(a) == a[i]:
			continue
		else:
			print('NO')
			i = 0
			break
	if i == n - 1:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = l[0] % 2
	f = 0
	for i in range(1, n):
		if l[i] % 2 != x:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	odd = 0
	even = 0
	for i in l:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == n or odd == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	parity = l[0] % 2
	ok = True
	for i in range(1, len(l)):
		if l[i] % 2 != parity:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


import collections

def solve(n, arr):
	isOddExist = False
	isEvenExist = False
	for num in arr:
		if num & 1:
			isOddExist = True
		else:
			isEvenExist = True
	return not (isOddExist and isEvenExist)
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	print('YES' if solve(n, arr) else 'NO')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	minHeight = min(a)
	broken = False
	if 0 not in a:
		for i in range(n):
			a[i] -= minHeight
			if a[i] % 2 != 0:
				broken = True
				break
	if broken:
		print('NO')
	else:
		print('YES')


from sys import *
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = [int(x) for x in stdin.readline().split()]
	c = [0, 0]
	for i in a:
		c[i % 2] += 1
	if c[0] and c[1]:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	if li[0] % 2 == 0:
		c = 0
		for i in range(1, n):
			if li[i] % 2 == 1:
				c = 1
				break
		if c == 0:
			print('YES')
		else:
			print('NO')
	else:
		c = 0
		for i in range(1, n):
			if li[i] % 2 == 0:
				c = 1
				break
		if c == 0:
			print('YES')
		else:
			print('NO')


def main():
	global STR, N, WAS
	cnt = int(input())
	for i in range(cnt):
		input()
		STR = input().split()
		f = True
		if len(STR) == 1:
			print('YES')
		else:
			p = 0
			lsr = False
			for c in STR:
				l = int(c)
				if f:
					f = False
					p = l
				if abs(p - l) % 2 != 0:
					lsr = True
					print('NO')
					break
				p = l
			if not lsr:
				print('YES')
main()


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	x = max(arr)
	ans = 'YES'
	for i in range(n):
		if (x - arr[i]) % 2 != 0:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(set(map(int, input().split())))
	c = 0
	c1 = 0
	for i in a:
		if i % 2 == 0:
			c += 1
		else:
			c1 += 1
	if c == len(a) or c1 == len(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	a1 = 0
	a2 = 0
	for j in a:
		if j % 2:
			a1 += 1
		elif not j % 2:
			a2 += 1
	if a1 and a2:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	r = min(l)
	u = 0
	for j in range(m):
		t = l[j] - r
		if t % 2 != 0:
			print('NO')
			u += 1
			break
	if u == 0:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = [0, 0]
	for i in l:
		c[i % 2] += 1
	if c[0] != 0 and c[1] != 0:
		print('NO')
	else:
		print('YES')


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
import functools
import sys
import bisect
import string
import math
import time
import random

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):
	mp = [1] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [1] + [mp_def[j] for j in s] + [1]
	mp += [1] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
t = I()
for _ in range(t):
	n = I()
	a = LI()
	b = a[0] % 2
	ans = 'Yes'
	for i in a:
		if b != i % 2:
			ans = 'No'
			continue
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for j in range(n):
		if a[0] % 2 != a[j] % 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	m = min(a)
	b = 0
	for i in range(len(a)):
		if not (a[i] - m) % 2 == 0:
			print('No')
			b = 1
			break
	if b == 0:
		print('Yes')


testnum = int(input())
res = []
for i in range(testnum):
	a = []
	a_size = int(input())
	temp = input().split()
	a += temp
	res.append('YES')
	for k in range(a_size - 1):
		if (int(a[k + 1]) - int(a[k])) % 2 == 1:
			res[i] = 'NO'
			break
for i in range(testnum):
	print(res[i])


n = int(input())
for _ in range(n):
	b = int(input())
	li = list(map(int, input().split()))
	minl = min(li)
	if all([(i - minl) % 2 == 0 for i in li]):
		print('YES')
	else:
		print('NO')


def check_a(a):
	for i in a:
		for j in a:
			if (i - j) % 2 != 0:
				return 'NO'
	return 'YES'
n = int(input())
for i in range(n):
	c = input()
	a = input().replace('\n', '').split(' ')
	a = [int(i) for i in a]
	res = check_a(a)
	print(res)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sum = 0
	for i in range(0, n):
		sum += a[i] % 2
	if sum == n or sum == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	n1 = int(input())
	all = [int(i) for i in input().split()]
	cnt = 0
	cnt1 = 0
	for i in all:
		if i % 2 == 0:
			cnt = cnt + 1
		else:
			cnt1 = cnt1 + 1
	if cnt == n1 or cnt1 == n1:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left, bisect_right

def go():
	n = int(input())
	a = list(map(int, input().split()))
	ma = min(a)
	return 'YES' if all(((aa - ma) % 2 == 0 for aa in a)) else 'NO'
t = int(input())
for _ in range(t):
	print(go())


for i in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	e = max(w)
	k = 1
	for i in w:
		if i % 2 != e % 2:
			print('NO')
			k = 0
			break
	if k == 1:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if len(a) == 1:
		print('YES')
	else:
		check = 1
		for i in range(1, n):
			if (a[i] - a[0]) % 2 != 0:
				check = 0
				break
		if check == 0:
			print('NO')
		else:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	heights = list(map(int, input().split()))
	s = set()
	for i in heights:
		s.add(i % 2)
		if len(s) == 2:
			break
	if len(s) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(0, t):
	(_, a) = (int(input()), list(map(int, input().split())))
	F = a[0] % 2
	Ans = 'YES'
	for i in range(1, len(a)):
		if a[i] % 2 != F:
			Ans = 'NO'
	print(Ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = min(l)
	flag = 0
	for i in range(n):
		l[i] -= a
		if l[i] & 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input().strip())
from collections import defaultdict
for _ in range(t):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	ans = defaultdict(int)
	for i in arr:
		ans[i % 2] += 1
	if 0 in ans and 1 in ans:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	f = 0
	n = int(input())
	l = list(map(int, input().split()))
	for j in range(len(l)):
		if abs(l[j] - l[j - 1]) % 2 != 0:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	X = list(map(int, input().split()))
	Max = max(X)
	Check = True
	for i in X:
		if (Max - i) % 2 != 0:
			Check = False
			break
	print('YES' if Check else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	ans = True
	for i in range(n - 1):
		if (l[i] - l[i + 1]) % 2 != 0:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	res = True
	for x in a:
		res = res and (mx - x) % 2 == 0
	print('YNEOS'[not res::2])


for t in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	mn = min(arr)
	arr = [x - mn for x in arr]
	ck = True
	for i in arr:
		if i % 2:
			ck = False
			break
	print('YES' if ck else 'NO')


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	V = [0, 0]
	for i in L:
		V[i % 2] += 1
	if V[0] == 0 or V[1] == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	x = [*map(int, input().split())]
	p = x.pop()
	print('YES' if all(((p - i) % 2 == 0 for i in x)) else 'NO')


(a, p, ar) = (0, 0, [])
for i in range(int(input())):
	p = -1
	a = int(input())
	ar = list(map(int, input().split()))
	for i in range(a):
		if p == -1:
			p = ar[i] % 2
		elif ar[i] % 2 != p:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	t = I()
	m = max(t)
	f = True
	for i in range(n):
		f = f and (m - t[i]) % 2 == 0
	print('YES') if f else print('NO')


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	m = max(arr)
	res = 'YES'
	for i in range(n):
		if (m - arr[i]) % 2 != 0:
			res = 'NO'
			break
	print(res)
t = int(input())
for _ in range(t):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	s = [int(x) for x in input().split()]
	c1 = 0
	c2 = 0
	for i in range(0, len(s)):
		if s[i] % 2 == 0:
			c2 = 1
		if s[i] % 2 != 0:
			c1 = 1
	if c1 == 1 and c2 == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	even = 0
	odd = 0
	v = int(input())
	b = list(map(int, input().split()))[:v]
	for j in b:
		if j % 2 == 0:
			even = even + 1
		else:
			odd = odd + 1
	if even == 0 or even == len(b):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a0 = 0
	a1 = 0
	for i in a:
		if i & 1:
			a1 = 1
		else:
			a0 = 1
	if a0 and a1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	s = 1
	l = list(map(int, input().split()))
	m = max(l)
	k = 1
	while 1:
		for j in range(0, len(l)):
			if l[j] != m:
				l[j] += 2
			if l[j] > m:
				k = 0
				break
		if k == 0:
			print('NO')
			break
		c = 0
		for j in l:
			if j != m:
				c = 1
				break
		if c == 0:
			print('YES')
			break


x = int(input())
for a in range(0, x):
	y = int(input())
	z = input().split()
	f = False
	f1 = False
	for b in range(0, y):
		z[b] = int(z[b])
		if z[b] % 2 == 0:
			f = True
		else:
			f1 = True
	if f and f1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	k = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		l = [False if i % 2 == 0 else True for i in k]
		if all(l):
			print('YES')
		else:
			p = [True if i % 2 == 0 else False for i in k]
			if all(p):
				print('YES')
			else:
				print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	jor = 0
	bijor = 0
	yo = input()
	yo = yo.split()
	for j in range(len(yo)):
		nmb = int(yo[j])
		if nmb % 2 == 0:
			jor = jor + 1
		else:
			bijor = bijor + 1
	if jor == 0 or bijor == 0:
		print('YES')
	else:
		print('NO')


def fuck(l):
	g = list(set(l))
	return len(g)
c = int(input())
while c > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if fuck(l) == 1:
		print('YES')
	else:
		sum = 0
		for i in range(0, n - 1, 1):
			f = l[n - 1] - l[i]
			if f % 2 == 0:
				sum += 1
			else:
				sum = 0
		if sum + 1 == n or n == 1:
			print('YES')
		else:
			print('NO')
	c -= 1


for _ in range(int(input())):
	n = int(input())
	ai = [*map(int, input().split())]
	if all((i % 2 == 0 for i in ai)) or all((i % 2 == 1 for i in ai)):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set((x % 2 for x in a))) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	even = [x for x in arr if x % 2 == 0]
	odd = [x for x in arr if x % 2 != 0]
	if len(even) == 0 or len(odd) == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
ans = ''
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	n = False
	y = False
	for j in c:
		if j % 2 == 0:
			y = True
			if n:
				break
		else:
			n = True
			if y:
				break
	if not (y and n):
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


T = int(input())
for k in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	m = max(A)
	q = 0
	for i in A:
		if (m - i) % 2 == 0:
			q += 1
			pass
		else:
			print('NO')
			break
	if q == len(A):
		print('YES')


import sys
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
for _ in range(get_int()):
	n = get_int()
	lst = sorted(get_int_list())
	if 0 in lst:
		print('NO')
	else:
		flag = True
		for i in range(n):
			for j in range(n):
				if i != j:
					if abs(lst[i] - lst[j]) % 2 != 0:
						flag = False
						break
		if flag:
			print('YES')
		else:
			print('NO')


for test_case in range(int(input())):
	n_cols = int(input())
	cols_list = list(map(int, input().split()[:n_cols]))
	cols_list.sort()
	diff_list = []
	for i in range(n_cols - 1, 0, -1):
		diff_list.append(cols_list[i] - cols_list[i - 1])
	for j in diff_list:
		if j % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	flag = 0
	for i in range(n):
		for j in range(i + 1, n):
			if abs(arr[i] - arr[j]) % 2 == 1:
				flag = 1
				break
		if flag == 1:
			break
	if n == 1:
		print('YES')
	elif flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for t in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split()]
	x = 0
	for i in range(0, n - 1):
		d = a[i + 1] - a[i]
		if d % 2 == 0:
			x = x + 1
	if x == n - 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	m = max(l)
	for i in l:
		if (m - i) % 2 != 0:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	p = 0
	for i in l:
		p += i % 2
	if p == 0 or p == n:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	cnto = sum(list(map(lambda x: int(x) % 2, input().split())))
	print('YES' if cnto == 0 or cnto == n else 'NO')


n = int(input())
for i in range(n):
	m = int(input())
	cols = list(map(int, input().strip().split()))
	ex = list()
	Max = max(cols)
	flag = True
	for k in cols:
		if (Max - k) % 2 != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


a = int(input())
for _ in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	jor = 0
	bejor = 0
	for i in range(b):
		if c[i] % 2 == 0:
			jor += 1
		else:
			bejor += 1
	if jor == b or bejor == b:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = min(l)
	kk = 0
	for k in range(n):
		l[k] -= s
		if l[k] % 2 != 0:
			kk = 1
			break
	if kk == 0:
		print('YES')
	else:
		print('NO')


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
ts = int(ri())
for _ in range(ts):
	n = int(ri())
	a = RI()
	flag = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) % 2 != 0:
			flag = not flag
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	odd = 0
	even = 0
	for i in range(n):
		if a[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd == n or even == n:
		print('Yes')
	else:
		print('NO')


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))
result = math.inf

def solve():
	n = Read.int()
	a = Read.list_int()
	t = 0
	for i in a:
		if i % 2 == 0:
			t += 1
	print('YES' if t == 0 or t == n else 'NO')
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


import sys
sys.setrecursionlimit(200000)
LI = lambda : list(map(int, sys.stdin.readline().split()))
MI = lambda : map(int, sys.stdin.readline().split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline())
ans = ['NO', 'YES']
for _ in range(II()):
	(n, a) = (II(), sum((i % 2 for i in LI())))
	print(ans[int(a == 0 or a == n)])


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	odds = 0
	evens = 0
	for i in range(n):
		if a[i] % 2 == 0:
			evens += 1
		else:
			odds += 1
	if odds == 0 or evens == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	array = input().split(' ')
	intArray = [int(numericString) for numericString in array]
	first = intArray[0] % 2
	isPossible = True
	for i in intArray:
		if i % 2 == first:
			continue
		else:
			isPossible = False
			break
	if isPossible:
		print('YES')
	else:
		print('NO')


reps = int(input())
for i in range(reps):
	n = int(input())
	line = [int(x) for x in input().split()]
	parity = line[0] % 2
	possible = True
	for i in range(n):
		if line[i] % 2 != parity:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	mn = min(a)
	if mn == max(a):
		print('YES')
		continue
	a = [i - mn for i in a]
	flag = True
	for i in range(n):
		if a[i] % 2 == 1:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


testcases = int(input())
results = []
for t in range(testcases):
	columns = int(input())
	heights = input().split()
	check_cond = 0
	for height in heights:
		if int(height) % 2 == 0:
			check_cond += 1
		else:
			check_cond -= 1
	if abs(check_cond) == int(len(heights)):
		results.append('YES')
	else:
		results.append('NO')
for result in results:
	print(result)


L = []
k = 1
m = 0
for _ in range(int(input())):
	input()
	L = list(map(int, input().split()))
	k = 1
	m = min(L)
	for x in L:
		if (x - m) % 2 != 0:
			k = 0
			break
	print('Yes' if k else 'No')


n = int(input())
while n:
	n -= 1
	t = int(input())
	arr = list(map(int, input().split(' ')))
	mx = max(arr)
	flg = 0
	for x in arr:
		if (mx - x) % 2 != 0:
			flg = 1
	if flg == 0:
		print('YES')
	else:
		print('NO')


def solve(n, nums):
	max_num = max(nums)
	for num in nums:
		if (max_num - num) % 2 == 1:
			return False
	return True

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		nums = list(map(int, input().split()))
		result = solve(n, nums)
		if result == True:
			print('YES')
		else:
			print('NO')
	return 0
main()


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	if all((i % 2 == x[0] % 2 for i in x)):
		print('YES')
	else:
		print('NO')


tc = int(input())
while tc:
	n = int(input())
	l = list(map(int, input().split()))
	k = [i for i in l if i % 2 == 1]
	m = [i for i in l if i % 2 == 0]
	if k and m:
		print('NO')
	else:
		print('YES')
	tc -= 1


def solve(n, a):
	e = 0
	o = 0
	for x in a:
		if x % 2 == 0:
			e += 1
		else:
			o += 1
	if e and o:
		return 'NO'
	else:
		return 'YES'
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
	t -= 1


t = int(input())
for z in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 1
	if a[0] % 2 != 0:
		flag = -1
	ansflag = 1
	for i in range(1, len(a)):
		if flag == 1 and a[i] % 2 != 0:
			ansflag = -1
		elif flag == -1 and a[i] % 2 == 0:
			ansflag = -1
	if ansflag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	y = max(arr)
	flag = 0
	for i in arr:
		if (y - i) % 2 == 0:
			continue
		else:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


a = int(input())
for p in range(a):
	flag = 1
	b = int(input())
	c = input().split(' ')
	d = int(c[0]) % 2
	for i in range(1, b):
		if int(c[i]) % 2 == d:
			flag = flag * 1
		else:
			flag = flag * 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	mod2 = l[0] % 2
	flag = 0
	for i in l:
		if i % 2 != mod2:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = max(a)
	l = []
	if n == 1:
		print('YES')
	else:
		for j in range(n - 1):
			f = a[j + 1] - a[j]
			l.append(f)
		if all((p % 2 == 0 for p in l)):
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(even, odd) = (0, 0)
	for i in a:
		if i % 2:
			odd += 1
		else:
			even += 1
	if even and odd:
		print('NO')
	else:
		print('YES')


def run():
	n = int(input())
	a = list(map(int, input().split()))
	parity = a[0] % 2
	for i in range(1, n):
		if a[i] % 2 != parity:
			print('NO')
			return
	print('YES')
tt = int(input())
while tt > 0:
	tt -= 1
	run()


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpln(n):
	return list((int(sys.stdin.readline()) for i in range(n)))
t = inp()
for _ in range(t):
	n = inp()
	a = inpl()
	x = 0
	for (i, t) in enumerate(a):
		if i == 0:
			x = t % 2
			continue
		if t % 2 != x:
			print('NO')
			break
	else:
		print('YES')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
from collections import Counter
import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = []
	for i in range(n):
		x.append(l[i] % 2)
	if len(set(x)) == 1:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		a[0] += 2
		zero_found = False
		while not zero_found:
			for i in range(n):
				a[i] -= 1
				if a[i] == 0:
					zero_found = True
		not_pos = False
		for i in a:
			if i % 2 != 0:
				not_pos = True
				break
		if not_pos:
			print('NO')
		else:
			print('YES')
main()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flag = 0
	for i in l:
		if i % 2 == 0:
			flag += 1
	a = flag / len(l)
	if a % 1 == 0:
		print('YES')
	else:
		print('NO')


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def solve(a):
	if all([item % 2 == 0 for item in a]) | all([item % 2 != 0 for item in a]):
		return 'YES'
	else:
		return 'NO'
answers = []
t = int(input())
for i in range(t):
	n = int(input())
	a = to_list(input())
	answers.append(solve(a))
print('\n'.join(answers))


from sys import exit

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	h = iis()
	(evens, odds) = (0, 0)
	for i in h:
		if i % 2 == 0:
			evens += 1
		else:
			odds += 1
	if evens == 0 or odds == 0:
		print('YES')
	else:
		print('NO')


test_count = int(input())
for i in range(test_count):
	col_count = int(input())
	cols = map(int, input().split())
	isEvenCol = 0
	first = True
	for height in cols:
		if first:
			isEvenCol = height % 2
			first = False
		elif height % 2 != isEvenCol:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	sp = list(map(int, input().split()))
	flag = 'YES'
	for i in range(1, n):
		if sp[i] % 2 != sp[0] % 2:
			flag = 'NO'
			break
	print(flag)


for i in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	for i in range(n):
		if (l[i] - l[0]) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin

def get_int_input():
	return int(stdin.readline())

def get_str_input():
	return input()

def multiple_input():
	return map(int, stdin.readline().split())

def list_input():
	return list(map(int, stdin.readline().split()))
t = get_int_input()
while t:
	t -= 1
	n = get_int_input()
	a = list_input()
	parity = a[0] & 1
	if all((e & 1 == parity for e in a)):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(ne, no) = (0, 0)
	for i in range(n):
		if a[i] % 2 == 0:
			ne += 1
	no = n - ne
	if no == n or ne == n:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	flag = -1
	e = 0
	o = 0
	for j in range(n):
		if l[j] % 2:
			o = 1
		else:
			e = 1
	if e and o:
		print('NO')
	else:
		print('YES')


query = int(input())
for _ in range(query):
	n = int(input())
	a = list(map(int, input().split()))
	p = True
	for i in range(n):
		if i == 0:
			d = a[i] % 2
		elif a[i] % 2 != d:
			p = False
			break
	if p == True:
		print('YES')
	else:
		print('NO')


def f(heights):
	m = min(heights)
	for n in heights:
		if (n - m) % 2 is 1:
			return False
	return True
for _ in range(int(input())):
	cols = input()
	heights = [int(i) for i in input().split(' ')]
	print('YES' if f(heights) else 'NO')


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	a = rl()
	b = set([x % 2 for x in a])
	if len(b) == 1:
		print('YES')
	else:
		print('NO')


s = int(input())
for _ in range(s):
	col = int(input())
	if col == 1:
		flag = True
	res = list(map(int, input().split()))
	if col >= 2:
		a = min(res)
		for i in range(len(res)):
			res[i] -= a
		for i in range(len(res)):
			if res[i] % 2 != 0:
				flag = False
				break
			else:
				flag = True
	if flag:
		print('YES')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	key = 0
	for i in range(n):
		for j in range(n):
			if abs(l[i] - l[j]) % 2 == 1:
				key = 1
				break
	if key == 0:
		print('YES')
	else:
		print('NO')


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	n = read_int()
	a = read_int_line()
	f = True
	c = 0
	d = 0
	for i in range(n):
		if a[i] % 2 == 0:
			c += 1
		else:
			d += 1
		if c >= 1 and d >= 1:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	(count_odd, count_even) = (0, 0)
	for j in a:
		if j % 2 == 1:
			count_odd += 1
		else:
			count_even += 1
	if (count_odd == len(a) or count_even == len(a)) or len(a) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
count = 0
answer = []
while count < t:
	n = int(input())
	ai = list(map(int, input().split()))
	if n in [0, 1]:
		answer.append('YES')
	else:
		parity = ai[0] % 2
		flag = True
		for i in ai:
			if i % 2 != parity:
				answer.append('NO')
				flag = False
				break
		if flag:
			answer.append('YES')
	count += 1
for i in answer:
	print(i)


def solve(lista):
	maxi = max(lista)
	for el in lista:
		if (maxi - el) % 2:
			return False
	return True

def citire():
	sol = []
	n = int(input())
	for i in range(n):
		m = int(input())
		lista = [int(x) for x in input().split()]
		if solve(lista):
			sol.append('YES')
		else:
			sol.append('NO')
	return sol
sol = citire()
for s in sol:
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	flag = False
	arr = list(map(int, input().split()))
	mini = min(arr)
	for i in arr:
		if i == mini:
			continue
		elif (i - mini) % 2 != 0:
			flag = True
	print('YES' if not flag else 'NO')


from collections import defaultdict
from math import gcd
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	flag = True
	for i in range(n):
		for j in range(i + 1, n):
			if abs(arr[j] - arr[i]) % 2 != 0:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	flag = 0
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) % 2 == 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	li = list(set(arr))
	li.sort()
	flag = 0
	if len(li) == 1:
		print('YES')
	else:
		for i in range(1, len(li)):
			if (li[i] - li[i - 1]) % 2 == 0:
				pass
			else:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')


t = int(input())
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	g = a[0] % 2
	t = True
	for x in a[1:]:
		if x % 2 != g:
			t = False
	if t:
		print('YES')
	else:
		print('NO')


it = int(input())
for n in range(it):
	cols = input()
	heights = [int(i) for i in input().split()]
	m = min(heights)
	heights = [(num - m) % 2 for num in heights]
	print('NO') if 1 in heights else print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	ch = input()
	L = [int(j) for j in ch.split()]
	for j in range(n):
		L[j] = L[j] % 2
	test = True
	for j in range(n):
		if L[j] != L[0]:
			test = False
			break
	if test:
		print('YES')
	else:
		print('NO')


q = int(input())

def kul(n, arr):
	o = 0
	e = 0
	for i in arr:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if e == 0 or o == 0:
		print('YES')
	else:
		print('NO')
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	kul(n, arr)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	nums = [int(x) for x in input().split(' ')]
	nums.sort()
	if n == 1:
		print('YES')
	else:
		bad = False
		for i in range(1, n):
			if (nums[i] - nums[i - 1]) % 2 != 0:
				print('NO')
				bad = True
				break
		if not bad:
			print('YES')


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	for i in range(n):
		a[i] -= m
	div = True
	for i in range(n):
		div &= a[i] % 2 == 0
	if div:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = max(a)
	x = 0
	for i in range(n):
		if (k - a[i]) % 2 != 0:
			x = 1
			break
	if x == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	for i in range(n - 1):
		if (a[i] + a[i + 1]) % 2:
			s = 1
	if s == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	data = tuple(map(int, input().split()))
	f = data[0] % 2
	for i in data:
		if i % 2 != f:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	even = 0
	odd = 0
	for i in range(n):
		if a[i] % 2 == 0:
			if odd == 1:
				print('NO')
				break
			else:
				even = 1
		elif even == 1:
			print('NO')
			break
		else:
			odd = 1
	else:
		print('YES')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
test = int(input())
for testcase in range(test):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
	else:
		g = gcd(arr[0], arr[1])
		for i in range(2, n):
			g = gcd(g, arr[i])
		for ele in arr:
			if (g - ele) % 2 == 1:
				print('NO')
				break
		else:
			print('YES')


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	n = int(input())
	a = read()
	flag = True
	for i in range(n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) % 2 == 1:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	flag = True
	n = int(input())
	a = list(map(int, input().split()))
	for j in range(n - 1):
		if a[j] % 2 != a[j + 1] % 2:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	mx = max(x)
	f = 1
	for i in x:
		if (mx - i) % 2 == 1:
			f = 0
			print('NO')
			break
	if f == 1:
		print('YES')


a = int(input())
for i in range(a):
	test = int(input())
	v = [int(i) for i in input().split()]
	flag = True
	for j in range(test):
		for k in range(test):
			if abs(v[j] - v[k]) % 2 != 0:
				print('NO')
				flag = False
				break
		if flag == False:
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	flag = True
	for i in range(n):
		for j in range(i + 1, n):
			if abs(A[i] - A[j]) % 2 != 0:
				flag = False
				break
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for test in range(t):
		n = stdin.readline()
		arr = [int(x) for x in stdin.readline().split()]
		check = False
		for i in range(int(n) - 1):
			if abs(arr[i] - arr[i + 1]) % 2 == 0:
				pass
			else:
				check = True
				break
		if check:
			stdout.write('NO\n')
		else:
			stdout.write('YES\n')
main()


t = int(input())
while t:
	n = int(input())
	a = list(map(lambda x: int(x), input().split()))
	ans = 1
	flag = 0
	if a[0] % 2 == 0:
		flag = 1
	if flag == 0:
		for i in range(1, n):
			if a[i] % 2 == 0:
				ans = 0
				break
	else:
		for i in range(1, n):
			if a[i] % 2 != 0:
				ans = 0
				break
	if ans == 0:
		print('NO')
	else:
		print('YES')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	a = max(l)
	shan = 0
	for e in l:
		if a - e & 1:
			shan = 1
			break
	if shan:
		print('NO')
	else:
		print('YES')


q = int(input())
for i in range(q):
	n = int(input())
	l = list(map(int, input().split(' ')))
	flag = 0
	for i in range(len(l) - 1):
		if (l[i + 1] - l[i]) % 2 != 0:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


T = int(input())
n = [0] * T
k = [0] * T
ns = [0] * T
for t in range(T):
	n[t] = int(input())
	ns[t] = [int(i) for i in input().split(' ')]
for t in range(T):
	p = ns[t][0] % 2
	d = 0
	for i in ns[t]:
		if i % 2 != p:
			print('NO')
			d = True
			break
	if not d:
		print('YES')


q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	if all((x % 2 for x in a)) or all(((x + 1) % 2 for x in a)):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	seq = [int(x) % 2 == 0 for x in input().split()]
	if sum(seq) == len(seq) or sum(seq) == 0:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	if any((a[0] % 2 != a[i] % 2 for i in range(1, n))):
		print('NO')
	else:
		print('YES')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if (l[j] - l[i]) % 2 != 0:
				f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = map(int, input().split())
	(odd, even) = (False, False)
	for i in arr:
		if i % 2 == 1:
			odd = True
		else:
			even = True
	print('NO' if odd and even else 'YES')


n = int(input())
for i in range(n):
	m = int(input())
	s = list(map(int, input().split()))
	h = 0
	nh = 0
	for j in s:
		if j % 2 == 0:
			h += 1
		else:
			nh += 1
	if h == 0 or nh == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin

def inp():
	return stdin.buffer.readline()

def itg():
	return int(inp())

def mpint():
	return map(int, inp().split())

def main():
	n = itg()
	arr = list(mpint())
	m = min(arr)
	arr = [a - m for a in arr]
	if not any(arr):
		return 'YES'
	for a in arr:
		if a & 1:
			return 'NO'
	return 'YES'
for case in range(itg()):
	print(main())


count = int(input())
for _ in range(count):
	field = int(input())
	line = list(map(int, input().split()))
	flag = 'YES'
	for i in range(1, field):
		if (line[i] - line[i - 1]) % 2 != 0:
			flag = 'NO'
			break
	print(flag)


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	P = max(A)
	flag = 0
	for i in range(len(A)):
		if (P - A[i]) % 2 == 0:
			continue
		else:
			print('NO')
			flag += 1
			break
	if flag == 0:
		print('YES')


test_cases = int(input())
ans = []
while test_cases != 0:
	flag = True
	cols = int(input())
	heights = list(map(int, input().split(' ')))
	heights.sort(reverse=True)
	for i in range(1, len(heights)):
		if (heights[i] - heights[i - 1]) % 2 != 0:
			ans.append('NO')
			flag = False
			break
	if flag:
		ans.append('YES')
	test_cases -= 1
for x in ans:
	print(x)


t = int(input())
for i in range(t):
	c = int(input())
	l = list(map(int, input().split()))
	m = max(l)
	check = 0
	for j in range(c):
		res = m - l[j]
		if res % 2 == 0:
			continue
		else:
			check = 1
			break
	if check == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	even = False
	odd = False
	k = int(input())
	n = list(map(int, input().split()))
	for j in range(k):
		if n[j] % 2 == 0:
			if odd:
				print('NO')
				break
			even = True
		elif even:
			print('NO')
			break
		else:
			odd = True
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	m = min(nums)
	nums = [i - m for i in nums]
	possible = True
	for i in nums:
		if i % 2 == 1:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


from sys import stdin
from collections import Counter
from math import sqrt, factorial, log10, log, floor, ceil
from itertools import permutations, combinations, combinations_with_replacement
input = stdin.readline

def li():
	return list(map(int, input().split()))

def lis():
	return list(map(str, input().split()))

def mp():
	return map(int, input().split())

def inp():
	return int(input())

def inps():
	return str(input().strip())

def pr(n):
	return stdout.write(str(n) + '\n')
INF = float('inf')

def solve():
	n = inp()
	a = li()
	x = min(a)
	for i in a:
		if i - x & 1:
			print('NO')
			return
	print('YES')
t = inp()
for i in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	a = set(map(int, input().split()))
	m = max(a)
	x = 0
	for j in a:
		if (m - j) % 2 != 0:
			x = 1
			print('NO')
			break
	if x != 1:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	st = set()
	liste = list(map(int, input().split()))
	for i in range(n):
		st.add(liste[i] % 2)
	if len(st) == 1:
		print('YES')
	else:
		print('NO')


for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = a[0] % 2
	for q1 in a:
		if q1 % 2 != k:
			print('NO')
			break
	else:
		print('YES')


def solve():
	n = int(input())
	odd = 0
	even = 0
	for it in list(map(int, input().split())):
		if it % 2 == 0:
			odd += 1
		else:
			even += 1
	if odd == 0 or even == 0:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(0, t):
	solve()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	A = map(int, input().split())
	(even, odd) = (True, True)
	for a in A:
		if a % 2 == 0:
			odd = False
		if a % 2 == 1:
			even = False
	if odd or even:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	n_odd = 0
	n_even = 0
	for i in arr:
		if i % 2 == 0:
			n_even += 1
		else:
			n_odd += 1
	if n_even and n_odd:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	rems = set()
	for i in a:
		rems.add(i % 2)
	if len(rems) == 1:
		print('YES')
	else:
		print('NO')


def sol():
	T = int(input())
	for i in range(T):
		size = int(input())
		A = list(map(int, input().split(' ')))
		(odd_count, even_count) = (0, 0)
		for n in A:
			if n % 2 == 0:
				even_count += 1
			else:
				odd_count += 1
		if even_count * odd_count != 0:
			print('NO')
		else:
			print('YES')
sol()


R = lambda : map(int, input().split())
t = int(input())

def solve(a):
	for i in range(1, len(a)):
		if (a[i] - a[i - 1]) % 2 != 0:
			return 'NO'
	return 'YES'
for _ in range(t):
	n = int(input())
	a = list(R())
	print(solve(a))


def run():
	n = int(input())
	nums = list(map(int, input().split()))
	flag = max(nums)
	for i in range(n):
		if nums[i] % 2 == flag % 2:
			pass
		else:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	run()


t = int(input())
for k in range(t):
	n = int(input())
	list1 = list(map(int, input().split(' ')))
	(odd, even) = (0, 0)
	for j in list1:
		if j & 1:
			odd += 1
		else:
			even += 1
	if odd == 0 or even == 0:
		print('YES')
	else:
		print('NO')


for test in range(int(input())):
	col = int(input())
	sps = input().split()
	for a in range(len(sps)):
		sps[a] = int(sps[a])
	num = max(sps)
	out_qdr = 0
	for n in sps:
		if n == num:
			continue
		out_qdr = (num - n) % 2
		if out_qdr > 0:
			print('NO')
			break
	if out_qdr == 0:
		print('YES')


cases = int(input())
for i in range(cases):
	col = int(input())
	line2 = input().split(' ')
	arr = []
	for ele in line2:
		arr.append(int(ele))
	c = 0
	for j in range(len(arr) - 1):
		d = arr[j + 1] - arr[j]
		if d % 2 != 0:
			c += 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	mn = min(arr)
	for i in range(len(arr)):
		arr[i] -= mn
	ans = True
	for i in arr:
		if i % 2 == 1:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ai = list(map(int, input().split()))
	ai.sort(key=lambda x: x % 2)
	if (ai[0] + ai[-1]) % 2 == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(e, o) = (0, 0)
	for i in a:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if e == n or o == n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	odd = False
	even = False
	a = list(map(int, input().split()))
	for j in a:
		if j % 2:
			odd = True
		else:
			even = True
	if odd and even:
		print('NO')
	else:
		print('YES')


t = int(input())
for te in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	oc = 0
	ec = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			ec += 1
		else:
			oc += 1
	if ec == n or oc == n:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	size = int(input())
	arr = list(map(int, input().split()))
	(odd, even) = (0, 0)
	for i in arr:
		if i % 2:
			even += 1
		else:
			odd += 1
	if not odd or not even:
		print('YES')
	else:
		print('NO')


test = int(input())
for i in range(test):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	sum = 0
	for i in arr:
		sum += i % 2
	if sum == n or sum == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	n = int(input())
	h = [int(x) for x in input().split()]
	s = set(h)
	diffs = []
	for x in s:
		for y in s:
			diffs.append(abs(y - x))
	diff = set(diffs)
	flag = True
	for x in diff:
		if x % 2 != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	s = sum([r % 2 for r in arr])
	if s != 0 and s != n:
		print('NO')
	else:
		print('YES')


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
res = []
for _ in range(ii()):
	n = ii()
	d = li()
	res.append('YES' if len(set([x % 2 for x in d])) == 1 else 'NO')
prr(res, '\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	o = sum((x % 2 for x in a))
	e = n - o
	if o == 0 or e == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
out = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	fl = 0
	for i in a:
		if i % 2 == a[0] % 2:
			fl += 1
	if fl == len(a):
		out.append('YES')
	else:
		out.append('NO')
for i in out:
	print(i)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	q = 'YES'
	for i in range(1, n):
		if (a[i] - a[i - 1]) % 2 != 0:
			q = 'NO'
			break
	print(q)


def qq(n, a):
	ch = 0
	nch = 0
	if n == 1:
		return 'YES'
	for i in range(n):
		if a[i] % 2 == 0:
			ch += 1
		else:
			nch += 1
	if nch != 0 and ch != 0:
		return 'NO'
	else:
		return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(qq(n, a))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
		continue
	k = -1
	fl = False
	k1 = -1
	while k != 0 and k != 1:
		k = 0
		k1 = 0
		k2 = 0
		for i in a:
			if i >= 1:
				k += 1
			if i == 1:
				k1 += 1
			if i == 0:
				k2 += 1
		if k1 + k2 == len(a) and k1 != len(a) and (k2 != len(a)):
			fl = True
			break
		if k == len(a):
			for i in range(len(a)):
				a[i] -= 1
		elif k != 1:
			for i in range(len(a)):
				if a[i] == 0:
					a[i] += 2
	if fl:
		print('NO')
		continue
	if k == 1:
		for i in a:
			if i >= 1 and i % 2 == 0:
				print('YES')
				break
			elif i >= 1 and i % 2 != 0:
				print('NO')
				break
	if k == 0:
		print('YES')


import math
from collections import defaultdict
x = int(input())
for _ in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = True
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) % 2 != 0:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


alph = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = a[0] % 2
	for j in range(1, n):
		if a[j] % 2 != f:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for z in range(0, t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a = [y - 1 for y in a]
	f = 0
	s = set(a)
	if n == 1 or len(s) == 1:
		print('YES')
	else:
		c = 0
		for x in a:
			if x % 2 != 0:
				c += 1
		if c != n and c != 0:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	j = min(a)
	for i in range(len(a)):
		a[i] = a[i] - j
	x = 0
	for i in a:
		if i % 2 != 0:
			x = 1
	if x == 0:
		print('YES')
	else:
		print('NO')


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 'YES'
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) % 2 == 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	for a in arr:
		if a % 2 != arr[0] % 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	m = min(arr)
	exist = True
	for i in arr:
		if (i - m) % 2 != 0:
			exist = False
			break
	if exist:
		print('YES')
	else:
		print('NO')


n = int(input())
ans = []
for i in range(n):
	input()
	arr = list(map(int, input().split()))
	if len(arr) == 1:
		ans.append('YES')
		continue
	arr = list(map(lambda x: x % 2, arr))
	if 1 in arr and 0 in arr:
		ans.append('NO')
	else:
		ans.append('YES')
print(*ans, sep='\n')


na = int(input())
for ia in range(na):
	nt = int(input())
	m = list(map(int, input().split()))
	mi = min(m)
	t = True
	for el in m:
		if (el - mi) % 2 != 0:
			t = False
			break
	if t:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	heights = list(map(int, input().split()))
	temp_max = max(heights)
	flag = 0
	for j in range(n):
		if (temp_max - heights[j]) % 2 != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


x = int(input())
for i in range(x):
	s = int(input())
	p = [int(x) for x in input().split()]
	n = 'YES'
	for j in range(0, s - 1):
		if (p[j] - p[j + 1]) % 2 != 0:
			n = 'NO'
	print(n)


def isOdd(num):
	if num % 2 != 0:
		return True
	else:
		return False

def isEven(num):
	if num % 2 == 0:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	cols = int(input())
	arrangement = list(map(int, input().split()))
	clear = 1
	if isOdd(arrangement[0]):
		for i in range(1, cols):
			if isEven(arrangement[i]):
				clear = 0
				break
	if isEven(arrangement[0]):
		for i in range(1, cols):
			if isOdd(arrangement[i]):
				clear = 0
				break
	if clear == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	b = max(a)
	flag = 0
	for i in a:
		if abs(b - i) % 2 != 0:
			flag = 1
	if flag == 1:
		print('NO\n')
	else:
		print('YES\n')
	t = t - 1


for _ in range(int(input())):
	columns = int(input())
	heights = [int(i) for i in input().split()]
	maximum = max(heights)
	for height in heights:
		if not (maximum - height) % 2 == 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
out = []
for i in range(t):
	n = int(input())
	is_even = []
	for height in input().split():
		is_even.append(int(height) % 2 == 0)
	if all(is_even) or not any(is_even):
		out.append('YES')
	else:
		out.append('NO')
print('\n'.join(out))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	print('YES') if all(((m - i) % 2 == 0 for i in a)) else print('NO')


for _ in range(int(input())):
	h = int(input())
	arr = tuple(map(int, input().split()))
	arr = list(map(lambda x: max(arr) - x, arr))
	odd = False
	for i in arr:
		if i % 2:
			odd = True
			break
	if odd:
		print('NO')
	else:
		print('YES')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	for i in range(ii()):
		n = ii()
		arr = li()
		for j in range(n):
			f = 0
			arr[j] += 2
			m = min(arr)
			for ele in arr:
				if (ele - m) % 2 == 0:
					continue
				else:
					break
			else:
				f = 1
			if f == 1:
				break
			arr[j] -= 2
		else:
			print('NO')
			continue
		print('YES')
main()


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	s = max(l)
	flag = 0
	for j in range(len(l)):
		if (s - l[j]) % 2:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
		continue
	(cnt0, cnt1) = (0, 0)
	for i in a:
		if i % 2 == 0:
			cnt0 += 1
		else:
			cnt1 += 1
	print('NO' if cnt1 != 0 and cnt0 != 0 else 'YES')


n = int(input())
for i in range(n):
	a = int(input())
	s = [int(i) for i in input().split(' ')]
	minimum = min(s)
	tmp = 0
	for j in s:
		if (minimum - j) % 2 == 1:
			tmp = 1
			break
	if tmp == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(o, e) = (0, 0)
	for i in arr:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if o != 0 and e != 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	m = min(arr)
	for i in range(n):
		arr[i] -= m
	b = True
	for i in arr:
		if i % 2 == 1:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from math import *
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	o = 0
	e = 0
	for i in a:
		if i % 2:
			o += 1
		else:
			e += 1
	if o == 0 or e == 0:
		print('YES')
	else:
		print('NO')


import sys
import heapq
from math import ceil, floor, gcd, fabs, factorial, fmod
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(var)

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	(even, odd) = (0, 0)
	arr = l()
	for i in arr:
		if i % 2:
			odd = 1
		else:
			even = 1
	if odd and even:
		out('NO\n')
		continue
	out('YES\n')


t = int(input())
for i in range(t):
	N = int(input())
	heights = input().split()
	isodd_0 = False
	ret = True
	for i in range(len(heights)):
		heights[i] = int(heights[i])
		if i == 0:
			if heights[i] % 2 == 0:
				isodd_0 = False
			else:
				isodd_0 = True
		else:
			if heights[i] % 2 == 0:
				isodd = False
			else:
				isodd = True
			if isodd != isodd_0:
				ret = False
	if ret:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [*map(int, input().split())]
	s = set()
	for i in range(n):
		s.add(l[i] % 2)
	if len(s) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = input().split(' ')
	a = list(map(int, a))
	for j in range(n):
		a[j] = a[j] % 2
	x = a.count(0)
	if x == n or x == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for t1 in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		e = 0
		o = 0
		for i in l:
			if i % 2 == 0:
				e = e + 1
			else:
				o = o + 1
		if o == 0 and e > 0 or (e == 0 and o > 0):
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = 0
	arr = list(map(int, input().split()))
	mn = min(arr)
	for el in arr:
		s += (el - mn) % 2
	if s == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
T = int(input())
for _ in range(T):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	x = a[0] % 2
	for i in range(1, n):
		if a[i] % 2 != x:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	a = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	m = 0
	for i in range(1, a):
		if (arr[0] - arr[i]) % 2 != 0:
			print('NO')
			m = 1
			break
	if m == 0:
		print('YES')


n_tests = int(input())
for _ in range(n_tests):
	n_cols = int(input())
	heights = [int(i) for i in input().split()]
	maxx = max(heights)
	valid = True
	for height in heights:
		if (maxx - height) % 2 != 0:
			print('No')
			valid = False
			break
	if valid:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(b, f) = (a[0] & 1, True)
	for i in range(1, n):
		if a[i] & 1 != b:
			f = False
			break
	print('YES' if f else 'NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(mod1, mod0) = (0, 0)
	for i in arr:
		if i & 1:
			mod1 += 1
		else:
			mod0 += 1
	if mod1 > 0:
		if mod0 > 0:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


CASES = int(input())
for i in range(CASES):
	N = int(input())
	arr = list(map(int, input().split()))
	k = max(arr)
	for j in range(N):
		arr[j] = arr[j] - k
	flag = 'YES'
	for j in range(N):
		if arr[j] % 2 != 0:
			flag = 'NO'
			break
	print(flag)


T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	max_a = max(arr)
	if any(((max_a - a) % 2 == 1 for a in arr)):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	k = [int(j) for j in input().split()]
	flag = 0
	c_eve = 0
	c_odd = 0
	for i in range(n - 1):
		if k[i] % 2 == 0 and k[i + 1] % 2 != 0:
			flag = 1
			break
		elif k[i] % 2 != 0 and k[i + 1] % 2 == 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	n0 = 0
	n1 = 0
	for i in arr:
		if i % 2 == 0:
			n0 += 1
		else:
			n1 += 1
	if n0 > 0 and n1 > 0:
		print('NO')
	else:
		print('YES')


def ans(a):
	k = 0
	for i in a:
		k = k + i % 2
	if k == 0 or k == len(a):
		return 'YES'
	else:
		return 'NO'
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(ans(a))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = [int(x) for x in input().split()]
		ans = 'YES'
		for j in range(1, n):
			if abs(a[0] - a[j]) % 2 != 0:
				ans = 'NO'
		print(ans)
main()


for _ in range(int(input())):
	N = int(input())
	T = list(map(int, input().split()))
	F = True
	for t1 in T:
		if not F:
			break
		for t2 in T:
			if abs(t1 - t2) % 2 != 0:
				F = False
				break
	print('YES' if F else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	alist = list(map(int, input().split()))
	oe = [a % 2 for a in alist]
	if sum(oe) in {0, n}:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	a = list(set(arr))
	a.sort()
	c = 0
	for i in range(1, len(a)):
		if (a[i] - a[i - 1]) % 2 != 0:
			c = 1
	if c == 0:
		print('YES')
	if c == 1:
		print('NO')


def testcase():
	n = int(input())
	tetris = [int(i) for i in input().split()]
	all_even = 1
	all_odd = 1
	for piece in tetris:
		if piece % 2 == 0:
			all_odd = 0
		else:
			all_even = 0
		if not (all_even or all_odd):
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	testcase()


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = int(input())
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	n = inp()
	a = inlt()
	odd = even = False
	for x in a:
		if x % 2 == 0:
			even = True
		else:
			odd = True
	if odd and even:
		print('NO')
	else:
		print('YES')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	sys.stdin.readline()
	line = sys.stdin.readline().split()
	nums = list(map(int, line))
	res = nums[0] % 2
	yes = True
	for i in range(1, len(nums)):
		if nums[i] % 2 != res:
			yes = False
			break
	if yes:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(x) for x in input().split()]
	r = min(ar)
	check = False
	for num in ar:
		if (num - r) % 2 == 1:
			print('NO')
			check = True
			break
	if not check:
		print('YES')


num_t = int(input())
for _ in range(num_t):
	input()
	a = [int(i) for i in input().split()]
	even = odd = False
	for e in a:
		if e & 1:
			even = True
		else:
			odd = True
	if even and odd:
		print('NO')
	else:
		print('YES')


t = int(input())
fl = False
for i in range(t):
	n = int(input())
	tet = list(map(int, input().split()))
	tet = sorted(tet)
	if n == 1:
		print('YES')
	else:
		for j in range(n - 1):
			for k in range(j + 1, n):
				if (tet[k] - tet[j]) % 2 != 0:
					print('NO')
					fl = True
					break
			if fl:
				break
		else:
			print('YES')
	fl = False


trials = int(input())
x = 0
lanes = []
presets = []
while x < trials:
	lanes.append(int(input()))
	presets.append(input())
	x += 1

def stringToList(target):
	nL = []
	word = ''
	for letter in target:
		if letter.isspace():
			nL.append(int(word))
			word = ''
		else:
			word += letter
	return nL
x = 0
while x < trials:
	work = True
	LanePre = list(map(int, presets[x].split()))
	if lanes[x] != 1:
		setting = 0
		first = False
		for num in LanePre:
			if first == False:
				setting = num % 2
				first = True
			elif num % 2 != setting:
				work = False
				break
	if work == True:
		print('YES')
	else:
		print('NO')
	x += 1


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	parity = set([j % 2 for j in a])
	if len(parity) == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	m = max(ar)
	ar.remove(m)
	diff = []
	for i in ar:
		diff.append(m - i)
	flag = True
	for i in diff:
		if i % 2 != 0:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


IA = lambda : map(int, input().split())
T = int(input())
for i in range(0, T):
	n = int(input())
	vis = [int(-1) for i in range(0, n + 1)]
	a = list(IA())
	le = len(a)
	flag = 1
	t = a[0] & 1
	for i in range(1, le):
		if a[i] & 1 != t:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	mn = min(arr)
	arr = [v - mn for v in arr]
	hasOdd = False
	for v in arr:
		if v % 2 == 1:
			hasOdd = True
			break
	if hasOdd:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	if all([i % 2 == 0 for i in l]) or all([i % 2 != 0 for i in l]):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = True
	for i in range(1, n):
		if (a[i] - a[i - 1]) % 2 != 0:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	m = int(input())
	data = sum(list(map(lambda x: int(x) % 2, input().split())))
	if not data or data == m:
		print('YES')
	else:
		print('NO')


test = int(input())
while test > 0:
	test -= 1
	n = int(input())
	ls = list(map(int, input().split(' ')))
	x = min(ls)
	flag = True
	for i in range(n):
		ls[i] = ls[i] - x
		if ls[i] % 2 == 1:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	l = sorted(list(set(l)))
	if len(l) == 1:
		return 'YES'
	n = len(l)
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) & 1 == 1:
			return 'NO'
	return 'YES'
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	l = list(map(int, stdin.readline().rstrip().split()))
	print(solve(l))


n_tests = int(input())
for i in range(n_tests):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	min_level = min(arr)
	result = list(filter(lambda l: (l - min_level) % 2 != 0, arr))
	if len(result):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	x = a[0] % 2
	if all((i % 2 == x for i in a)):
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	c = lst[0] % 2
	for i in lst:
		if i % 2 != c:
			print('NO')
			return
	print('YES')
for i in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	for i in range(1, n):
		if (lis[i] - lis[i - 1]) % 2 == 1:
			print('NO')
			break
	else:
		print('YES')
		continue


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = [int(k) for k in stdin.readline().split()]
	arr.sort()
	counter = 0
	for i in range(1, n):
		if (arr[i] - arr[0]) % 2 == 0:
			continue
		else:
			counter = 1
			break
	if counter == 1:
		stdout.write('NO')
		stdout.write('\n')
	else:
		stdout.write('YES')
		stdout.write('\n')


t = int(input())
b = [0] * t
for i in range(t):
	n = int(input())
	a = [0] * n
	m = 0
	l = 0
	p = input()
	s = p.split()
	for j in range(len(a)):
		l += int(s[j]) % 2
	if l == n or l == 0:
		b[i] = 1
for i in range(t):
	if b[i] == 1:
		print('YES')
	else:
		print('NO')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	a = list(rint())
	m = min(a)
	for i in range(n):
		a[i] -= m
	for i in range(n):
		if a[i] % 2:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	Found = False
	for i in range(len(arr) - 1):
		if Found:
			break
		if abs(arr[i] - arr[i + 1]) & 1:
			Found = True
	if not Found:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	values = [int(x) for x in input().split()]
	rem = values[0] % 2
	for i in range(1, len(values)):
		if rem != values[i] % 2:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for i in range(n):
	m = int(input())
	count = 0
	l = list(map(int, input().split()))
	for j in range(m - 1):
		for k in range(j + 1, m):
			if (l[k] - l[j]) % 2 != 0:
				count = 1
				break
	if count == 1:
		print('NO')
	else:
		print('YES')


import sys
import math
from collections import Counter
from collections import deque as deq
from functools import lru_cache
INT_MAX = float('inf')
INT_MIN = float('-inf')
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
while t:
	a = inp()
	n = inlt()
	c = 0
	for i in n:
		if i % 2:
			c += 1
	if c == 0 or c == a:
		print('YES')
	else:
		print('NO')
	t -= 1


def fun(L):
	fa = 0
	fb = 0
	for i in range(len(L)):
		if L[i] % 2 == 0:
			fa = 1
		else:
			fb = 1
	return not (fa and fb)
	return True
n = int(input())
while n > 0:
	n -= 1
	m = int(input())
	L = list(map(int, input().split()))
	if 0 <= len(L) <= 1:
		print('YES')
	elif len(L) == 2:
		if L[0] % 2 == L[1] % 2:
			print('YES')
		else:
			print('NO')
	elif fun(L):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	od = 0
	ev = 0
	for i in li:
		if i % 2 == 0:
			ev += 1
		else:
			od += 1
	if od > 0 and ev == 0:
		print('YES')
	elif ev > 0 and od == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = 'NO'
	if all((i % 2 == 0 for i in a)) or all((i % 2 != 0 for i in a)):
		ans = 'YES'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	a = max(arr)
	check = True
	for x in arr:
		if a - x & 1:
			check = False
	print('YES' if check else 'NO')


def duplicates(l):
	a = l[0]
	for i in l:
		if a != i:
			return True
	return False
length = int(input())
for i in range(length):
	str_len = int(input())
	heights = input().split(' ')
	for j in range(str_len):
		heights[j] = int(heights[j])
	for l in range(max(heights)):
		for k in range(len(heights)):
			heights[k] -= 1
			if heights[k] == 0:
				heights[k] += 2
	if not duplicates(heights):
		print('YES')
	else:
		print('NO')


test_cases = int(input())
test = test_cases
data = []
test_case_width = []
while test_cases > 0:
	test_case_width.append(input())
	data.append(input().split())
	test_cases -= 1
evenorodd = 0
for i in range(0, test):
	for j in range(0, int(test_case_width[i])):
		if int(data[i][j]) % 2 != 0:
			evenorodd += 1
	if evenorodd == 0 or evenorodd == int(test_case_width[i]):
		print('YES')
	else:
		print('NO')
	evenorodd = 0


T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	prev = arr[0] % 2
	check = True
	for i in arr[1:]:
		if i % 2 != prev:
			print('NO')
			check = False
			break
	if check:
		print('YES')


t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	flag = True
	for i in range(n):
		l[i] += 2
		mini = min(l)
		for j in range(n):
			l[j] -= mini
		for j in range(n):
			if l[j] % 2 != 0:
				flag = False
				break
		if flag == False:
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	flag = 0
	if l[0] % 2 != 0:
		flag = 1
	t = 0
	for i in l:
		if flag == 0:
			if i % 2 != 0:
				t = 1
				break
		if flag == 1:
			if i % 2 == 0:
				t = 1
				break
	if t == 1:
		print('NO')
	else:
		print('YES')


t = input()
ns = []
nums = []
for i in range(int(t)):
	ns.append(input())
	input_list = input()
	nums.append(input_list.split())
for i in range(int(t)):
	m = max(nums[i])
	u = 0
	for j in range(len(nums[i])):
		if (int(m) - int(nums[i][j])) % 2 != 0:
			u += 1
	if u == 0:
		print('YES')
	else:
		print('NO')


def tetris(n, l):
	e = 0
	o = 0
	for i in range(n):
		if l[i] % 2 == 0:
			e += 1
		else:
			o += 1
	if e == n or o == n:
		return 1
	else:
		return 0
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	f = tetris(n, l)
	if f == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 'okay'
	if n >= 1:
		for i in range(n - 1):
			temp = abs(a[i] - a[i + 1])
			if temp % 2 == 1:
				flag = 'not okay'
				break
	if flag == 'okay':
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	columns = int(input())
	arrange = [int(m) for m in input().split()]
	t = arrange[0] % 2
	count = 0
	for j in arrange:
		if j % 2 != t:
			print('NO')
			break
		count += 1
	if count == len(arrange):
		print('YES')


r = input
exec('n=int(r());print("YNEOS"[sum(int(i)%2for i in input().split())%n!=0::2]);' * int(r()))


t = int(input())
for i in range(t):
	n = int(input())
	inp = input()
	inp = inp.split()
	helper = int(inp[0]) % 2
	ans = True
	for j in range(len(inp)):
		if int(inp[j]) % 2 != helper:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	s = list(filter(lambda x: x % 2 == 0, l))
	if len(s) == 0 or len(s) == a:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	h = a[0] % 2
	status = 0
	for j in range(n):
		p = a[j] % 2
		if p != h:
			status = 1
			break
	if status == 0:
		print('YES')
	else:
		print('NO')


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	base = A[0] % 2
	for a in A[1:]:
		if a % 2 != base:
			NO()
			break
	else:
		YES()


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	mn = min(lst)
	for j in range(n):
		lst[j] -= mn
	tset = False
	for j in range(n):
		if lst[j] % 2 != 0:
			tset = True
			print('NO')
			break
	if not tset:
		print('YES')


liczbaTestow = int(input())
for x in range(liczbaTestow):
	liczbaKolumn = int(input())
	napis = input().split()
	if len(napis) == liczbaKolumn:
		lista = []
		for y in range(len(napis)):
			lista.append(int(napis[y]))
		najmniejsza = int(lista[0])
		for z in range(len(lista)):
			if int(lista[z]) < najmniejsza:
				najmniejsza = int(lista[z])
		nowaLista = []
		for k in range(len(lista)):
			if int(lista[k]) > 0:
				nowaLista.append(int(lista[k]) - najmniejsza)
		logika = True
		for l in range(len(nowaLista)):
			if int(nowaLista[l]) % 2 != 0:
				logika = False
				break
		if logika == True:
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict
import bisect
import heapq as hq

def main():
	try:
		for _ in range(int(input())):
			n = int(input())
			l = list(map(int, input().split()))
			t = max(l)
			q = 0
			for x in l:
				if abs(t - x) % 2 != 0:
					q = 1
					break
			if q == 0:
				print('YES')
			else:
				print('NO')
	except:
		pass
M = 998244353
P = 1000000007
main()


import sys
import math
for _ in range(int(input())):
	x = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	s = sorted(s)
	flag = 0
	for i in range(1, len(s)):
		if (s[i] - s[i - 1]) % 2 == 0:
			continue
		else:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


import math
q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l = list(set(l))
	flag = 0
	for i in range(len(l) - 1):
		for j in range(i + 1, len(l)):
			if abs(l[i] - l[j]) % 2 != 0:
				flag = -1
				break
	if flag == 0:
		print('YES')
	else:
		print('No')


import math

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
t = inp()
while t:
	n = inp()
	a = inlist()
	mini = min(a)
	res = 'YES'
	for i in a:
		if (i - mini) % 2 != 0:
			res = 'NO'
			break
	print(res)
	t -= 1


t = int(input())
z = 0
while z < t:
	n = int(input())
	c = 0
	a = list(map(int, input().split()))
	a = sorted(a)
	m = a[len(a) - 1]
	for p in a:
		if (m - p) % 2 == 0:
			c += 1
	if c == len(a):
		print('YES')
	else:
		print('NO')
	z += 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	ce = 0
	for i in a:
		if i % 2 == 0:
			count += 1
		if i % 2 != 0:
			ce += 1
	if ce == n or count == n:
		print('YES')
	else:
		print('NO')


def calc(n):
	a = list((int(j) for j in input().strip().split()))
	odd = even = 0
	for i in a:
		if i % 2 == 1:
			odd = odd + 1
		if i % 2 == 0:
			even = even + 1
	if odd == 0 or even == 0:
		res = 'YES'
	else:
		res = 'NO'
	return res

def main():
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		print(calc(n))
main()


for _ in [0] * int(input()):
	input()
	print('YNEOS'[len({x % 2 for x in map(int, input().split())}) > 1::2])


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	od = False
	ev = False
	for j in l:
		if od and ev:
			break
		if j % 2 == 0:
			ev = True
		else:
			od = True
	if od and ev:
		print('NO')
	else:
		print('YES')


for tin in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	y = 0
	for _ in range(n):
		if a[_] % 2 == 0:
			x += 1
		else:
			y += 1
	if x == 0 or y == 0:
		print('YES')
	else:
		print('NO')


x = int(input())
for _ in range(x):
	y = int(input())
	xs = list(map(int, input().split()))
	if all((n % 2 == 0 for n in xs)) or all((n % 2 == 1 for n in xs)):
		print('YES')
	else:
		print('NO')


t = int(input())

def y_n(l=[]):
	length = len(l)
	if length == 1:
		return True
	for i in range(length - 1):
		for j in range(i + 1, length):
			if abs(l[i] - l[j]) % 2 != 0:
				return False
	return True
for row in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	if y_n(c):
		print('YES')
	else:
		print('NO')


qz = int(input())
for row in range(qz):
	n = int(input())
	l = list(map(int, input().split()))
	dasiey = True
	for i in range(1, n):
		if (l[i] - l[i - 1]) % 2 == 1:
			dasiey = False
	if dasiey:
		print('YES')
	else:
		print('NO')


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	ele = max(arr)
	(eve, odd) = (0, 0)
	for i in range(n):
		if arr[i] % 2 == 0:
			eve += 1
		else:
			odd += 1
	if eve >= 1 and odd >= 1:
		print('NO')
	else:
		print('YES')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = max(arr)
	flag = 1
	for i in range(n):
		if (ans - arr[i]) % 2 != 0:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = sum([x % 2 for x in a])
	if s != 0 and s != n:
		print('NO')
	else:
		print('YES')


t = int(input())
from collections import Counter
for i in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	l = [item % 2 for item in inp]
	c = Counter(l)
	if len(c.keys()) == 2:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	s = sum([int(x) % 2 for x in input().split()])
	if s == 0 or s == n:
		print('YES')
	else:
		print('NO')


def ifsolved(n, height):
	indexParity = height[0] % 2
	for i in range(1, n):
		if indexParity != height[i] % 2:
			print('NO')
			return
	print('YES')
	return
testcase = int(input())
N = []
height = []
for i in range(testcase):
	N.append(int(input()))
	height.append([int(ele) for ele in input().split()])
for i in range(testcase):
	ifsolved(N[i], height[i])


q = int(input())
for rwe in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	dasie = True
	for i in range(1, n):
		if (l[i] - l[i - 1]) % 2 == 1:
			dasie = False
	if dasie:
		print('YES')
	else:
		print('NO')


def main():
	import sys
	input = sys.stdin.readline
	for _ in range(int(input())):
		N = int(input())
		A = list(map(int, input().split()))
		flg = A[0] & 1
		ok = 1
		for a in A:
			if a & 1 != flg:
				ok = 0
		if ok:
			print('YES')
		else:
			print('NO')

def __starting_point():
	main()
__starting_point()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	if a[0] % 2 == 0:
		for v in a:
			if v % 2 == 1:
				print('NO')
				break
		else:
			print('YES')
	else:
		for v in a:
			if v % 2 == 0:
				print('NO')
				break
		else:
			print('YES')


def solve(lst):
	ind = lst.index(max(lst))
	check = True
	for i in range(1, len(lst)):
		if lst[i] != lst[ind]:
			check = False
			break
	if check:
		return 'YES'
	for i in range(len(lst)):
		if i == ind:
			continue
		if (lst[ind] - lst[i]) % 2 != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	cols_size = list(map(int, input().split()))
	ans = solve(cols_size)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(j) for j in input().split()]
	r = 0
	p = s[0] % 2
	for j in range(1, n):
		if s[j] % 2 != p:
			r = 1
			print('NO')
			break
	if r == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	(maxx, flag) = (max(arr), True)
	for i in range(n):
		diff = maxx - arr[i]
		if diff & 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for qwe in range(t):
	n = int(input())
	listt = list(map(int, input().split()))
	minn = min(listt)
	for i in range(n):
		listt[i] -= minn
	listtans = []
	for i in range(n):
		listtans.append(listt[i] % 2)
	listtans = set(listtans)
	if len(listtans) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	numofodd = 0
	for i in range(n):
		if li[i] % 2 == 1:
			numofodd += 1
	if numofodd == 0 or numofodd == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	ok = True
	for i in range(len(a)):
		if (a[i] - mx) % 2 == 0:
			pass
		else:
			print('NO')
			ok = False
			break
	if ok:
		print('YES')


n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip().split(' ')
	G = 0
	S = 0
	K = 0
	for j in range(0, len(p)):
		if int(p[j]) % 2 == 0 and G == 0:
			G = 0
			S = 1
		elif int(p[j]) % 2 != 0 and S == 0:
			S = 0
			G = 1
		else:
			K = 1
			break
	if K == 1:
		print('NO')
	else:
		print('YES')


from functools import reduce
t = int(input())
while t:
	n = int(input())
	a = list(map(lambda x: bool(int(x) % 2), input().split()))
	if reduce(lambda x, y: x and y, a) or not reduce(lambda x, y: x or y, a):
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 1:
		print('YES')
	else:
		mn = min(a)
		for i in range(len(a)):
			a[i] = a[i] - mn
			a[i] = a[i] % 2
		if a.count(0) == len(a):
			print('YES')
		else:
			print('NO')


import math
t = int(input())
for z in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	f = False
	for i in range(0, n - 1):
		if (l[i] - l[i + 1]) % 2 != 0:
			print('NO')
			f = not f
			break
	if not f:
		print('YES')


n = int(input())
for i in range(n):
	t = int(input())
	c = list(map(int, input().split()))
	d = [c[0] % 2]
	flag = 0
	for j in range(1, t, 1):
		if c[j] % 2 == d[len(d) - 1]:
			d.append(c[j] % 2)
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for _ in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	mn = min(b)
	f = 0
	for i in range(a):
		b[i] -= mn
		if b[i] % 2 == 1:
			f = 1
	if f:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	x = int(input())
	num = list(map(int, input().split()))
	iseven = False
	isodd = False
	for i in num:
		if i % 2 == 0:
			iseven = True
		if i % 2 == 1:
			isodd = True
	print('YES' if iseven and (not isodd) or (isodd and (not iseven)) else 'NO')


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		(even, odd) = (0, 0)
		ans = 'YES'
		for i in range(n):
			if a[i] % 2:
				odd = 1
			if not a[i] % 2:
				even = 1
			if even and odd:
				ans = 'NO'
				break
		print(ans)
main()


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for i in range(t):
	n = ii()
	a = iia()
	x = [0, 0]
	for j in a:
		x[j % 2] += 1
	if x[0] > 0 and x[1] > 0:
		print('NO')
	else:
		print('YES')


from math import sqrt
t = int(input())
while t:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	tmp = a[0]
	if n == 1:
		print('YES')
		continue
	flag = True
	for i in a[1:]:
		if abs(tmp - i) % 2 == 0 or tmp == i:
			pass
		else:
			flag = False
			break
		tmp = i
	if flag:
		print('YES')
	else:
		print('NO')


def field(lista, n):
	high = max(lista)
	for i in lista:
		if abs(high - i) % 2 == 1:
			return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	lista = input().split()
	for j in range(n):
		lista[j] = int(lista[j])
	if field(lista, n):
		print('YES')
	else:
		print('NO')


def read():
	n = int(input())
	a = list(map(int, input().split()))
	return (n, a)

def solve(n, a):
	m = 0
	for ai in a:
		if ai > m:
			m = ai
	for ai in a:
		if (m - ai) % 2 != 0:
			return False
	return True
for i in range(int(input())):
	result = solve(*read())
	print('YES' if result else 'NO')


def fun(ls, n):
	mn = min(ls)
	for i in ls:
		if (i - mn) % 2 != 0:
			print('NO')
			return
	print('YES')
T = int(input())
for _ in range(T):
	n = list(input())
	ls = list(map(int, input().split()))
	fun(ls, n)


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())

def conv(x):
	return bin(x).replace('0b', '')
for t in range(int(data())):
	n = int(data())
	A = list(mdata())
	o = e = 0
	for i in A:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if e == n or o == n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = [int(n) for n in input().split()]
	d = min(x)
	for i in range(n):
		x[i] -= d
	f = 0
	for i in x:
		if i & 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	li = set(map(int, input().strip().split(' ')))
	no = 0
	noo = 0
	flag = 0
	for x in li:
		if x % 2 == 0:
			no += 1
		else:
			noo += 1
		if not (no == 0 or noo == 0):
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	S = list(map(int, input().split()))
	x = S[0] % 2
	for elem in S:
		if elem % 2 != x:
			print('NO')
			break
	else:
		print('YES')


for q in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	res = 'YES'
	for i in range(n - 1):
		if (a[i + 1] - a[i]) % 2 == 1:
			res = 'NO'
			break
	print(res)


n_tests = int(input())
for n in range(n_tests):
	n_col = int(input())
	h = [int(x) for x in input().split()]
	if n_col == 1:
		print('YES')
	else:
		if h[0] % 2 == 0:
			even = True
		else:
			even = False
		possible = True
		for i in h:
			if even:
				if i % 2 != 0:
					print('NO')
					possible = False
					break
				else:
					continue
			elif i % 2 != 0:
				continue
			else:
				print('NO')
				possible = False
				break
		if possible:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('YES')
		continue
	ans = max(l)
	flag = False
	for i in l:
		if (ans - i) % 2 != 0:
			flag = True
			break
	if flag == True:
		print('NO')
	else:
		print('YES')


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		base = aa[0] % 2
		for a in aa:
			if a % 2 != base:
				print('NO')
				return
		print('YES')
	q = int(input())
	for _ in range(q):
		solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	print('YES' if len(set([i % 2 for i in list(map(int, input().split()))])) == 1 else 'NO')


for _ in ' ' * int(input()):
	a = int(input())
	s = sum((1 for i in map(int, input().split()) if i % 2))
	print('NO' if s > 0 and a - s > 0 else 'YES')


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	return 'YES' if all([i % 2 == 0 for i in arr]) or all([i % 2 == 1 for i in arr]) else 'NO'
t = int(input())
for _ in range(t):
	print(solve())


T = int(input())
for z in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	c = 0
	x = A[0] % 2
	for i in A:
		if i % 2 != x:
			c = 1
	if c == 1:
		print('NO')
	else:
		print('YES')


a = int(input())
for i in range(a):
	q = int(input())
	lt = list(map(int, input().split(' ')))
	temp = lt[0] % 2
	temp1 = 0
	temp3 = len(lt)
	for j in range(len(lt)):
		if lt[j] % 2 == temp:
			temp1 = temp1 + 1
	if temp1 == temp3:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	if l[0] % 2 == 0:
		for y in l:
			if y % 2 != 0:
				print('NO')
				f = 1
				break
		if f == 0:
			print('YES')
	else:
		for y in l:
			if y % 2 == 0:
				print('NO')
				f = 1
				break
		if f == 0:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	o = [i for i in a if i & 1]
	e = [i for i in a if not i & 1]
	print('NO' if o and e else 'YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = []
	c = 0
	for i in range(n - 1):
		b.append(a[i] - a[i - 1])
	for j in range(len(b)):
		if b[j] % 2 != 0:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	k = l[0] % 2
	flag = 0
	for i in range(n):
		if l[i] % 2 != k:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


k = int(input())
for w in range(k):
	n = input()
	height = [int(i) for i in input().split()]
	test = height[0] % 2
	flag = True
	for i in height:
		if i % 2 != test:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I())
	arr = list(map(int, I().split()))
	flag = ''
	for i in range(n):
		if arr[i] % 2 == 0:
			flag += '0'
		else:
			flag += '1'
	if '0' in flag and '1' in flag:
		ans += 'NO\n'
	else:
		ans += 'YES\n'
print(ans)


a = int(input())
while a >= 1:
	a -= 1
	n = int(input())
	l = input()
	l = l.split(' ')
	f = 0
	for i in range(0, n - 1):
		if abs(int(l[i]) - int(l[i + 1])) % 2 == 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	heights = list(map(int, input().split()))
	even_count = len(list(filter(lambda x: x % 2 == 0, heights)))
	odd_count = len(list(filter(lambda x: x % 2 != 0, heights)))
	if even_count == n or odd_count == n:
		print('YES')
	else:
		print('NO')


n = int(input())
for j in range(n):
	l = int(input())
	A = [int(i) for i in input().split()]
	state = A[0] % 2
	durum = True
	for i in A:
		tmp = i % 2
		if tmp != state:
			durum = False
			break
	if durum:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	eve = 0
	odd = 0
	a = list(map(int, input().split()[:n]))
	for i in a:
		if i % 2 == 0:
			eve += 1
		elif i % 2 != 0:
			odd += 1
	if odd == n or eve == n:
		print('YES')
	else:
		print('NO')


n = int(input())
output = []
for i in range(n):
	nc = int(input())
	c = list(map(int, input().split(' ')))
	m = min(c)
	c = [e - m for e in c]
	for e in c:
		if e == 0:
			e += 2
			break
	p = False
	if max(c) == 0:
		output.append('YES')
	else:
		for e in c:
			if e % 2 != 0:
				output.append('NO')
				p = True
				break
		if not p:
			output.append('YES')
for i in output:
	print(i)


def tetris(n, ar):
	oddValue = False
	evenValue = False
	minVal = min(ar)
	for i in ar:
		j = i - minVal
		if j % 2 == 0:
			evenValue = True
		else:
			oddValue = True
	if n == 1:
		print('YES')
		return
	if evenValue is True and oddValue is True:
		print('NO')
	else:
		print('YES')

def main():
	t = int(input())
	while t != 0:
		size = map(int, input())
		lst = list(map(int, input().strip().split()))
		tetris(size, lst)
		t -= 1
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	yes = 0
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) % 2 == 1:
			print('NO')
			yes = 1
			break
	if yes == 0:
		print('YES')


for _ in range(int(input())):
	t = int(input())
	l = list(map(int, input().split()))
	m = min(l)
	f = True
	for i in range(len(l)):
		l[i] -= m
		if l[i] % 2 == 1:
			f = False
	if f == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(k) for k in input().split()]
	even = a[0] % 2 == 0
	yes = True
	for x in a:
		if even != (x % 2 == 0):
			yes = False
			break
	if yes:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	ct1 = 0
	ct2 = 0
	for i in range(n):
		if arr[i] & 1 == 1:
			ct1 += 1
		else:
			ct2 += 1
	if ct1 == n or ct2 == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ch = 1
	ost = a[0] % 2
	for j in a:
		if ost != j % 2:
			ch = 0
	if ch == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	n = int(input())
	A = map(int, input().split())
	B = list(A)
	i = 0
	C = []
	while i < n - 1:
		C.append(abs(B[i] - B[i + 1]))
		i += 1

	def check():
		if n == 1:
			return 'YES'
		d = 0
		while d < n - 1:
			if C[d] % 2 == 1:
				return 'NO'
			d += 1
		return 'YES'
	print(check())
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = min(l)
	var = 1
	for qq in range(len(l)):
		if (l[qq] - m) % 2 != 0:
			var = 0
			break
	if var == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		if (a[i] - min(a)) % 2:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	flag = 1
	list1 = list(map(int, input().split()))
	maz = max(list1)
	for i in list1:
		if (maz - i) % 2 != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


cases = int(input())
while cases:
	cases -= 1
	num = int(input())
	arr = list(map(int, input().split()))
	odds = sum((1 for i in arr if i % 2 != 0))
	if odds == 0 or odds == num:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n):
		if l[i] == 0:
			l[i] = 2
	c = 0
	f = 0
	for i in range(n):
		if l[i] % 2 == 0 and c == 0:
			c += 1
		elif l[i] % 2 and f == 0:
			f += 1
	if c + f == 2:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().strip().split()]
	c = 0
	for e in a:
		if e % 2 == 0:
			c += 1
	if c == 0 or c == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	array = [int(x) for x in input().split()]
	maximum = max(array)
	for j in array:
		if (maximum - j) % 2 == 0:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


answer_list = []
start_state = []
column_number = []
num_cases = int(input())
for i in range(0, num_cases):
	column_number.insert(i, int(input()))
	start_state.insert(i, list(map(int, input().split())))
for j in range(0, num_cases):
	judge = 1
	max_height = int(max(start_state[j]))
	for k in range(0, column_number[j]):
		if (max_height - start_state[j][k]) % 2 != 0:
			judge = 0
			break
	if judge == 1:
		answer_list.insert(j, 'YES')
	else:
		answer_list.insert(j, 'NO')
for m in range(0, num_cases):
	print(answer_list[m])


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	ref = max(arr)
	z = True
	for i in range(n):
		if (arr[i] - ref) % 2 != 0:
			z = False
	if z:
		print('YES')
	else:
		print('NO')


t = int(input())
a = list()
otvet = list()
for i in range(t):
	n = int(input())
	a = input().split(' ')
	if n == 1:
		otvet.append('YES')
		continue
	for i in range(n - 1):
		if (int(a[i]) - int(a[i + 1])) % 2 == 0:
			b = True
		else:
			b = False
			break
	if b:
		otvet.append('YES')
	else:
		otvet.append('NO')
for i in otvet:
	print(i)


try:
	t = int(input())
	while t:
		n = int(input())
		c = 0
		a = list(map(int, input().strip().split()))[:n]
		for i in range(0, n):
			if a[i] % 2 != 0:
				c = c + 1
		if c == n or c == 0:
			print('YES')
		else:
			print('NO')
except:
	pass


def obnulenie():
	global a, minn
	b = []
	minn = 101
	for index in range(len(a)):
		b.append(int(a[index]))
	for index in b:
		if minn > index:
			minn = index
	for index in range(len(b)):
		b[index] -= minn
	a = b

def apppend():
	global a
	for i in range(len(a) - 1):
		a.sort()
		a[0] += 2

def check_win():
	global a
	fl = 0
	for i in a:
		if i == 0:
			fl += 1
	if fl == len(a):
		return 1
	else:
		return 0

def check_obn():
	global a
	for i in range(len(a)):
		if a[i] == 0:
			return 1
	return 0
t = int(input())
minn = 101
out_put = []
for i in range(t):
	n = int(input())
	a = input().split()
	obnulenie()
	check_win()
	iter = 0
	while check_win() != 1:
		iter += 1
		apppend()
		if check_obn() == 0:
			obnulenie()
		if iter >= 200:
			out_put.append('NO')
			break
	if iter < 200:
		out_put.append('YES')
for i in range(t):
	print(out_put[i])


import sys
input = sys.stdin.readline

def in_int():
	return int(input())

def in_list():
	return list(map(int, input().split()))

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
t = in_int()
for tt in range(t):
	n = in_int()
	a = in_list()
	odd = False
	even = False
	for x in a:
		if x % 2 == 0:
			even = True
		else:
			odd = True
	if not (odd and even):
		print('YES')
	else:
		print('NO')


import bisect, collections

def solution(T):
	n = int(input().strip())
	(even, odd) = (0, 0)
	for x in input().strip().split(' '):
		if int(x) % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == 0 or odd == 0:
		print('YES')
	else:
		print('NO')

def main():
	T = int(input().strip())
	for _ in range(T):
		solution(T)
main()


N = int(input())
for t in range(N):
	n = int(input())
	A = list(map(int, input().split()))
	m = min(A)
	for a in A:
		if (a - m) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		arr = list(RL())
		(a, b) = (False, False)
		for i in arr:
			if i % 2 == 0:
				a = True
			if i % 2 != 0:
				b = True
		if a and b:
			print('NO')
		else:
			print('YES')
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = 'YES'
	piv = a[0] % 2
	for i in range(1, len(a)):
		if a[i] % 2 != piv:
			res = 'NO'
			break
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	o = a[0] % 2
	z = 0
	for i in range(1, n):
		if a[i] % 2 != o:
			z = 1
			break
	if z == 0:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for i in range(0, test_cases):
	num_colm = int(input())
	num_of_blocks = input().split()
	count = 0
	for x in range(0, num_colm - 1):
		diff = abs(int(num_of_blocks[x]) - int(num_of_blocks[x + 1]))
		if diff % 2 == 0:
			count = count + 1
		elif diff == 0:
			count = count + 1
		else:
			break
	if count == num_colm - 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	height = list(map(int, input().split()))
	maxHeight = max(height)
	possible = False
	for i in height:
		if (maxHeight - i) % 2 == 0:
			possible = True
		else:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
	else:
		a = A[0] % 2
		for i in range(1, n):
			if A[i] % 2 != a:
				print('NO')
				break
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	flag = sum(list(map(lambda x: int(x) % 2, input().split())))
	print('YNEOS'[0 if flag == 0 or flag == n else 1::2])


t = int(input())
for tt in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	sm = 0
	for i in arr:
		sm += i % 2
	if sm == 0 or sm == n:
		print('YES')
	else:
		print('NO')


t = int(input())
fin_p = []
for e in range(t):
	n = int(input())
	ais = input().split()
	for i in range(n):
		ais[i] = int(ais[i])
	while all([u > 0 for u in ais]):
		ais = [y - 1 for y in ais]
	ans = 1
	for r in ais:
		if r % 2 == 1:
			ans = 0
			fin_p.append('NO')
			break
	if ans == 1:
		fin_p.append('YES')
for w in fin_p:
	print(w)


for _ in range(int(input())):
	col = int(input())
	l = list(map(int, input().split()))
	out = False
	for i in range(len(l) - 1):
		diff = abs(l[i + 1] - l[i])
		if diff % 2 == 0:
			continue
		else:
			print('NO')
			out = True
			break
	if out == False:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	myl = []
	myl = list(map(int, input().strip().split()))[:n]
	odds = False
	evens = False
	for i in myl:
		if i % 2 == 0:
			evens = True
		else:
			odds = True
	if odds and evens:
		print('NO')
	else:
		print('YES')


t = int(input())
while t != 0:
	l = int(input())
	arr = list(map(int, input().split()))
	m = min(arr)
	for i in range(len(arr)):
		arr[i] = arr[i] - m
		arr[i] = arr[i] % 2
	arr1 = set(arr)
	if len(arr1) == 1 and 0 in arr1:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	w = int(input())
	data = list(map(int, input().split()))
	maximum = max(data)
	flag = False
	for i in range(w):
		if (maximum - data[i]) % 2 != 0:
			flag = True
			break
	if flag == False:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	sum = 0
	for i in l:
		if i % 2 == 0:
			ans += 1
		elif i % 2 != 0:
			sum += 1
	if ans == n or sum == n:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	input()
	counter = 0
	x = list(map(int, input().split()))
	if max(x) % 2 == 0:
		for j in x:
			if j % 2 != 0:
				print('NO')
				counter = 1
				break
		if counter == 0:
			print('YES')
	else:
		for k in x:
			if k % 2 == 0:
				print('NO')
				counter = 1
				break
		if counter == 0:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	odd = 0
	even = 0
	a = list(map(int, input().split()))
	for j in range(n):
		if a[j] % 2 != 0:
			odd += 1
		else:
			even += 1
	if odd == n or even == n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = a[0] & 1
	if sum((i & 1 ^ m for i in a)) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	f = True
	n = int(input())
	a = list(map(int, input().split()))
	x = min(a)
	for j in range(n):
		a[j] -= x
	for j in a:
		if j % 2 == 1:
			f = False
			print('NO')
			break
	if f:
		print('YES')


T = int(input())
for tc in range(T):
	N = int(input())
	a = list(map(int, input().split()))
	result = 'YES'
	for i in range(1, N):
		if (a[i] - a[0]) % 2:
			result = 'NO'
			break
	print(result)


tc = int(input())
for _ in range(tc):
	num = int(input())
	arr = [int(x) for x in input().split()]
	even = 0
	odd = 0
	for ele in arr:
		if ele % 2 == 0:
			even += 1
		else:
			odd += 1
	print('YES' if odd == num or even == num else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	f = s[0] % 2 == 0
	f1 = True
	for i in range(1, n):
		if s[i] % 2 == 1 and f or (s[i] % 2 == 0 and (not f)):
			f1 = False
			break
	if f1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = map(int, input().split())
	s = list(s)
	MIN = min(s)
	for (i, x) in enumerate(s):
		s[i] = x - MIN
	if all([x % 2 == 0 for x in s]):
		print('YES')
	else:
		print('NO')


mod = 10 ** 9 + 7
import math
from bisect import bisect_left
from collections import Counter
from itertools import combinations

def ain():
	return map(int, input().split())

def fain():
	return map(float, input().split())

def mc2(s):
	return s * (s - 1) // 2 + s
for _ in range(int(input())):
	n = int(input())
	l = list(ain())
	e = 0
	o = 0
	for x in l:
		if x % 2 == 0:
			e = 1
		else:
			o = 1
	if e == 1 and o == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split()]
	mx = max(a)
	even = 0
	odd = 0
	for j in range(0, n):
		ans = mx - a[j]
		if ans % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == 0 and odd > 0:
		print('YES')
	elif even > 0 and odd == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	temp = max(A)
	for i in range(n):
		if (temp - A[i]) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(_) for _ in input().split()]
	a = [_ % 2 for _ in a]
	if len(set(a)) == 1:
		print('YES')
	else:
		print('NO')


def solution(arr):
	i = 1
	while i < len(arr):
		if abs(arr[i] - arr[i - 1]) % 2 != 0:
			return 'NO'
		i += 1
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	print(solution(A))


import sys
input = sys.stdin.readline
for j in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	odd = False
	even = False
	for xd in a:
		if xd % 2 == 1:
			odd = True
		elif xd % 2 == 0:
			even = True
	if even and odd:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	field = list(map(int, input().split()))
	min_lvl = min(field)
	for i in range(len(field)):
		field[i] = field[i] - min_lvl
	var_check = True
	div = None
	for i in range(len(field)):
		if i == 0:
			div = field[i] % 2
			continue
		if field[i] % 2 != div:
			var_check = False
			break
	if var_check:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect

def solve(A):
	odd = 0
	even = 0
	for a in A:
		if a % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd and even:
		return False
	return True

def main():
	for _ in range(int(input())):
		n = int(input())
		A = list(map(int, input().split()))
		if solve(A):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = 0
	for i in range(n):
		if l[i] > m:
			m = l[i]
	s = 0
	boo = True
	for i in range(n):
		if (m - l[i]) % 2 != 0:
			boo = False
			break
	print('YES' if boo == True else 'NO')


for i in range(int(input())):
	(oe, n) = ([0, 0], input())
	for num in map(int, input().split()):
		oe[num & 1] += 1
	if min(oe) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	if 0 < sum((int(j) % 2 for j in input().split())) < n:
		print('NO')
	else:
		print('YES')


import os
import sys
import collections
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	nums = list(map(int, input().split()))
	ans = 'YES'
	for x in nums:
		for y in nums:
			if (x + y) % 2 == 1:
				ans = 'NO'
				break
	print(ans)


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	n = int(sys.stdin.readline().rstrip())
	num = list(map(int, sys.stdin.readline().rstrip().split()))
	m = min(num)
	re = True
	for i in num:
		if (i - m) % 2 != 0:
			re = False
			break
	if re:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 1
	for i in range(len(a) - 1):
		for j in range(1, len(a)):
			if (a[i] - a[j]) % 2 != 0:
				flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('YES')
		continue
	m = max(arr)
	f = 1
	for i in arr:
		if (m - i) % 2 != 0:
			f = 0
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	p = 0
	a = list(map(int, input().split()))
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) % 2 == 1:
			p = p + 1
			break
	if p == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = max(a)
	for i in a:
		if i % 2 != a[0] % 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
ans = [True for i in range(t)]
for i in range(t):
	odd = 0
	even = 0
	n = int(input())
	a = [int(j) for j in input().split()]
	for j in range(n):
		if a[j] % 2 == 0:
			even = 1
		else:
			odd = 1
		if even == odd:
			ans[i] = False
			break
for i in ans:
	if i == True:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(councils, a, k):
	summ = 0
	for x in a:
		summ += min(x, councils)
	return summ // councils >= k
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def solve():
	n = int(input())
	a = list(read())
	a.sort()
	for i in range(1, n):
		if (a[i] - a[i - 1]) % 2 == 1:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


t = int(input())
stp = 0
ans = []
cnt = 0
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for k in a:
		if k % 2 == 0:
			cnt += 0
		else:
			cnt += 1
	if cnt == n:
		ans.append('YES')
	elif cnt == 0:
		ans.append('YES')
	else:
		ans.append('NO')
	cnt = 0
for i in ans:
	print(i)


def main():
	for _ in range(int(input())):
		input()
		if len(set((int(i) % 2 for i in input().split()))) == 1:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = [int(x) for x in input().split()]
	odd = False
	even = False
	for i in arr:
		if i % 2 == 0:
			even = True
		if i % 2 == 1:
			odd = True
	if odd == False:
		print('YES')
	elif even == False:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	col = int(input())
	nums = list(map(int, input().split()))
	minn = min(nums)
	check = False
	for i in range(col):
		if (nums[i] - minn) % 2 != 0:
			check = True
			break
	if check:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s = input().split()
	a = []
	for i in range(n):
		a.append(int(s[i]))
	if n == 1:
		print('YES')
		continue
	flag_0 = 0
	flag_1 = 0
	for x in a:
		if x % 2 == 0:
			flag_0 = 1
		else:
			flag_1 = 1
	if flag_1 * flag_0 == 1:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	for i in a:
		c += i % 2
	ans = 'YES' if c == 0 or c == n else 'NO'
	print(ans)


import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7

def input():
	return sys.stdin.readline().strip()

def gcd(x, y):
	return y if x % y == 0 else gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)

def I():
	return int(input())

def LI():
	return [int(x) for x in input().split()]

def RI(N):
	return [int(input()) for _ in range(N)]

def LRI(N):
	return [[int(x) for x in input().split()] for _ in range(N)]
T = I()
for i in range(T):
	N = I()
	A = LI()
	flag = True
	for i in range(N - 1):
		if (A[i + 1] - A[i]) % 2 != 0:
			flag = False
	print('YES' if flag else 'NO')


for t in range(int(input())):
	_ = input()
	a = [int(x) % 2 for x in input().split()]
	print('NO' if a.count(0) and a.count(1) else 'YES')


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(mapi())
	odd = True
	for i in a:
		if i % 2 == 0:
			odd = False
	even = True
	for i in a:
		if i % 2 != 0:
			even = False
	if even or odd:
		print('YES')
	else:
		print('NO')


from sys import stdin

def main():
	readline = stdin.readline
	t = int(readline())
	res = []
	for i in range(t):
		n = int(readline())
		a = list(map(int, readline().split()))
		for j in range(n):
			if j == 0:
				m = a[j] % 2
			elif a[j] % 2 != m:
				res.append('NO')
				break
		else:
			res.append('Yes')
	for i in range(t):
		print(res[i])
main()


t = int(input())
while t:
	even = odd = 0
	n = int(input())
	l = list(map(int, input().split()))
	for i in l:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	if even > 0 and odd > 0:
		print('NO')
	else:
		print('YES')
	t -= 1


n = int(input())
for _ in range(n):
	m = int(input())
	mat = list(map(lambda x: int(x) % 2, input().split()))
	print('NO' if len(set(mat)) > 1 else 'YES')


t = int(input())
for _ in range(t):
	n = int(input())
	ar = {int(c) % 2 for c in input().split()}
	if ar == {0} or ar == {1}:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	field = list(map(int, input().split()))
	for i in range(n):
		field[i] %= 2
	if field.count(field[0]) != n:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	mass = [int(x) for x in input().split()]
	a = 0
	b = 0
	for j in range(n):
		if mass[j] % 2 == 0:
			a += 1
		else:
			b += 1
	if a != 0 and b != 0:
		print('NO')
	else:
		print('YES')


from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
import sys
sys.setrecursionlimit(50000)
import collections
from collections import defaultdict, deque
import collections
T = int(input())
for _ in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	if len(set([a % 2 for a in A])) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
res = []
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort(reverse=True)
	x = A[0] + 2
	for a in A[1:]:
		while x > a:
			a += 2
		if a > x:
			res.append('NO')
			break
	else:
		res.append('YES')
print(*res)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	if a[0] % 2:
		flag = 1
	else:
		flag = 0
	for x in a:
		if x % 2 == 1 and flag == 0:
			print('no')
			return
		elif x % 2 == 0 and flag == 1:
			print('no')
			return
	print('yes')
t = int(input())
for i in range(t):
	solve()


cases_count = int(input())
for case in range(cases_count):
	col_count = int(input())
	cols = [int(i) for i in input().split(' ')]
	if all((height % 2 == 0 for height in cols)) or all((height % 2 == 1 for height in cols)):
		print('YES')
	else:
		print('NO')


from math import *
import heapq
T = int(input())
for _ in range(T):
	N = map(int, input().split())
	arr = list(map(int, input().split()))
	odd = 0
	even = 0
	for i in arr:
		if i % 2 == 0:
			even = 1
		else:
			odd = 1
	if odd == 1 and even == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = max(a)
	f = 0
	for i in a:
		if (k - i) % 2 != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	mod = []
	if n == 1:
		print('YES')
		return
	for x in range(1, n):
		mod.append((a[x] - a[x - 1]) % 2)
	if 1 in mod:
		print('NO')
	else:
		print('YES')
t = int(input())
for x in range(t):
	solve()


n = int(input())
for i in range(n):
	s = int(input())
	a = list(map(int, input().split()))
	x = a[0] % 2
	flg = True
	for i in a[1:]:
		if i % 2 != x:
			flg = False
			break
	if flg:
		print('Yes')
	else:
		print('No')


def func(arr):
	for j in range(len(arr) - 1):
		if (arr[j + 1] - arr[j]) % 2 == 1:
			return False
	return True
n = int(input())
for i in range(n):
	k = int(input())
	field = list(map(int, input().split()))
	if func(field):
		print('YES')
	else:
		print('NO')


num = int(input())
for i in range(num):
	nn = int(input())
	l_n = list(map(int, input().split()))
	flag1 = False
	flag2 = False
	for i in l_n:
		if i % 2 == 0:
			flag1 = True
	for i in l_n:
		if i % 2:
			flag2 = True
	if flag1 and flag2:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	odd = even = 0
	for val in a:
		if val % 2 == 0:
			even = 1
		else:
			odd = 1
	if even == 0 or odd == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		if len(set((c % 2 for c in a))) == 1:
			rr.append('YES')
		else:
			rr.append('NO')
	return JA(rr, '\n')
print(main())


t = int(input())
while t:
	t -= 1
	n = int(input())
	k = sum(list(map(lambda x: int(x) % 2 == 0, input().split())))
	print('YES' if k == n or k == 0 else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	foo = True
	for j in range(n):
		for k in range(n):
			if abs(a[j] - a[k]) % 2 != 0:
				foo = False
	if foo:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		for i in range(1, n):
			if (a[i] - a[i - 1]) % 2 != 0:
				print('NO')
				break
		else:
			print('YES')
main()


a = int(input())
for _ in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	l1 = 0
	if all((c[i] % 2 == 0 for i in range(b))):
		print('YES')
	elif all((c[i] % 2 != 0 for i in range(b))):
		print('YES')
	else:
		print('NO')


c = int(input())
for a in range(c):
	n = int(input())
	x = input().split()
	y = int(x[0]) % 2
	z = 1
	for b in x:
		if int(b) % 2 != y:
			z = 0
	if z:
		print('Yes')
	else:
		print('No')


from sys import stdin
t = int(stdin.readline().rstrip())
for i in range(t):
	N = int(stdin.readline().rstrip())
	data = [int(x) for x in stdin.readline().rstrip().split()]
	ans1 = [i % 2 == 0 for i in data]
	ans2 = [i % 2 != 0 for i in data]
	if all(ans1) or all(ans2):
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	n = int(input())
	a = map(int, input().split())
	a = list(a)
	a.sort()
	list_min = a[0]
	c = 0
	for i in range(len(a)):
		a[i] = a[i] - list_min
		if a[i] % 2 != 0:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
k = []
for i in range(n):
	a = int(input())
	t = list(map(int, input().rstrip().split()))
	flag = 0
	for b in range(a):
		for c in range(a):
			if (t[b] - t[c]) % 2 == 1:
				flag = 1
				break
	if flag == 1:
		k.append('NO')
	else:
		k.append('YES')
for l in range(n):
	print(k[l])


import math
import time
t = int(input())

def solve():
	n = input()
	data = input().split()
	a = []
	maxx = 0
	for x in data:
		a.append(int(x))
		if maxx < int(x):
			maxx = int(x)
	track = 0
	for x in a:
		if (maxx - x) % 2 == 1:
			print('NO')
			track = 1
			break
	if track == 0:
		print('YES')
for i in range(t):
	solve()


n = int(input())
for i in range(n):
	m = int(input())
	mat = list(map(int, input().split()))
	rest = mat[0] % 2
	bol = True
	for element in mat:
		if element % 2 != rest:
			bol = False
			break
	if bol:
		print('YES')
	else:
		print('NO')


I = input
exec(int(I()) * "I();print('YNEOS'[{int(x)%2for x in I().split()}>{0}::2]);")


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = max(arr)
	c = 0
	for i in range(n):
		if (a - arr[i]) % 2 != 0:
			print('No')
			c = 1
			break
	if c == 0:
		print('Yes')


def answer(width, cols):
	for i in range(0, len(cols) - 1):
		diff = cols[i + 1] - cols[i]
		if diff % 2 == 1:
			return 'NO'
	return 'YES'
testCase = int(input())
for _ in range(0, testCase):
	width = int(input())
	cols = list(map(int, input().split()))
	print(answer(width, cols))


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	b = []
	se = 0
	so = 0
	for i in a:
		if i % 2 == 0:
			se += 1
		else:
			so += 1
	if se == n or so == n:
		print('YES')
	else:
		print('NO')


n = int(input())
for x in range(n):
	m = int(input())
	t = list(map(int, input().split()))
	b = False
	for y in range(0, len(t) - 1):
		if abs(t[y] - t[y + 1]) % 2 != 0:
			print('NO')
			b = True
			break
	if b == True:
		continue
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	out = min(l)
	for j in range(n):
		l[j] -= out
		if l[j] % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for cs in range(t):
	n = int(input())
	cnt1 = 0
	cnt2 = 0
	a = list(map(int, input().split()))
	i = 0
	for i in range(n):
		x = int(a[i])
		if x % 2 == 0:
			cnt1 += 1
		else:
			cnt2 += 1
	if cnt1 == n or cnt2 == n:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = 0
	s = 0
	if a[0] % 2 == 0:
		b = 0
	else:
		b = 1
	for i in a:
		if i % 2 == 0:
			if b == 0:
				continue
			else:
				b = 1
				s = 1
				break
		elif b == 1:
			continue
		else:
			b = 0
			s = 1
			break
	if s:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	input()
	if len(set(map(lambda x: int(x) % 2, input().split()))) == 2:
		print('NO')
	else:
		print('Yes')


I = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	l = I()
	c = 0
	for i in l:
		c += i % 2
	if c == 0 or c == n:
		print('YES')
	else:
		print('NO')


for tc in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	f = 1
	g = l[0] % 2
	for i in range(n):
		if l[i] % 2 != g:
			f = 0
			break
	print('YES') if f else print('NO')


for _ in range(int(input())):
	input()
	a = list(map(int, input().split()))
	M = max(a)
	f = 0
	for s in a:
		if (M - s) % 2:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


n = int(input())
l = []
m = []
for i in range(n):
	m.append(int(input()))
	l.append(input().split())
for i in range(n):
	count = 0
	for j in range(m[i] - 1):
		for k in range(j + 1, m[i]):
			if (int(l[i][j]) - int(l[i][k])) % 2 != 0:
				print('NO')
				count = count + 1
				break
		else:
			continue
		break
	if count == 0:
		print('YES')


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
import statistics

def main():
	t = inin()
	for _ in range(t):
		n = inin()
		a = ain()
		x = y = 0
		for i in a:
			if i % 2 == 0:
				x = 1
			else:
				y = 1
		if x * y == 1:
			print('NO')
		else:
			print('YES')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


a = int(input())
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(a):
	leng = int(input())
	arr = list(map(int, input().split()))
	counter = 0
	for test in arr:
		if test % 2 == 0:
			counter = counter + 1
	if counter == leng:
		print('YES')
	elif counter == 0:
		print('YES')
	if counter != leng and counter != 0:
		print('NO')


import math
t = int(input())
ans = []
for j in range(t):
	n = int(input())
	s = input().split()
	p = 0
	for i in range(len(s)):
		s[i] = int(s[i])
	for i in range(len(s) - 1):
		for l in range(i + 1, len(s)):
			if abs(s[i] - s[l]) % 2 == 1:
				p = 1
				break
	if p == 0:
		ans.append('YES')
	else:
		ans.append('NO')
for i in range(len(ans)):
	print(ans[i])


import math

def test(data):
	parity = data[0] % 2
	for a in range(1, len(data)):
		if data[a] % 2 != parity:
			print('NO')
			return
	print('YES')
T = int(input())
for i in range(T):
	N = int(input())
	info = list(map(int, input().split()))
	test(info)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	bit = l[0] % 2
	for i in range(1, n):
		if l[i] % 2 != bit:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for x in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	mx = max(l)
	for x in range(n):
		l[x] = mx - l[x]
	flag = False
	for x in l:
		if x % 2:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	hihi = [i % 2 for i in arr]
	print('YES' if hihi.count(1) == 0 or hihi.count(0) == 0 else 'NO')


for i in range(int(input())):
	a = input()
	f = 1
	l = list(map(int, input().split()))
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) % 2 != 0:
			f = 0
	if f == 1:
		print('YES')
	else:
		print('NO')


n = int(input())

def foo(arr, is_odd):
	for i in arr:
		if i % 2 != is_odd:
			return 'NO'
	return 'YES'
for i in range(n):
	width = int(input())
	columns = [int(i) for i in input().split()]
	if columns[0] % 2 == 0:
		odd_or_not = 0
	else:
		odd_or_not = 1
	print(foo(columns, odd_or_not))


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	e = 0
	o = 0
	for ele in a:
		if ele % 2 == 0:
			e += 1
		else:
			o += 1
	if e == len(a) and o == 0 or (o == len(a) and e == 0):
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	x = int(input())
	y = list(map(int, input().split()))
	small = min(y)
	answer = 'YES'
	for i in y:
		if (i - small) % 2 != 0:
			answer = 'NO'
	print(answer)


t = int(input())
for t1 in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	z = max(l)
	x = 'YES'
	for i in l:
		if (z - i) % 2 == 0:
			continue
		else:
			x = 'NO'
			break
	print(x)


from sys import stdin
t = int(input())
for _ in range(t):
	(n,) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	o = 0
	e = 0
	for i in a:
		if i % 2 == 1:
			o += 1
		if i % 2 == 0:
			e += 1
	if o != 0 and e != 0:
		print('NO')
	else:
		print('YES')


def tetris(l, n):
	if n == 1:
		return 'YES'
	if len(set(l)) == 1:
		return 'YES'
	m = max(l)
	for i in range(n):
		if (m - l[i]) % 2 != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(tetris(l, n))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	wrong = False
	for i in a:
		if (i - m) % 2 == 1:
			wrong = True
			break
	print('NO' if wrong else 'YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	f = 1
	for i in range(n):
		a[i] -= m
		if a[i] % 2 == 1:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
for t in range(I()):
	n = I()
	arr = L()
	c = 0
	m1 = max(arr)
	for i in range(n):
		if (m1 - arr[i]) % 2 == 0:
			c += 1
		else:
			break
	if c == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = min(a)
	f = 0
	for i in range(n):
		if (a[i] - x) % 2 != 0:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = list(a)
	for i in range(n):
		c[i] -= min(a)
		if c[i] % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
a = []
flag = 0
for i in range(t):
	n = int(input())
	a = [int(s) % 2 for s in input().split()]
	for j in range(1, n):
		if a[j] != a[j - 1]:
			print('NO')
			flag = 1
			break
	if flag != 1:
		print('YES')
	flag = 0


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(s) % 2 for s in input().split(' ')]
	if sum(a) % n == 0:
		print('YES')
	else:
		print('NO')


T = int(input())

def ans(A):
	m = max(A)
	for a in A:
		if (m - a) % 2 != 0:
			return 'NO'
	return 'YES'
for _ in range(T):
	input()
	A = input().split(' ')
	A = [int(x) for x in A]
	print(ans(A))


from collections import Counter, defaultdict, deque
from heapq import heapify, heappush, heappop, heappushpop
from sys import stdin
int_inp = lambda : int(stdin.readline().strip())
lst_inp = lambda : [int(i) for i in stdin.readline().strip().split(' ')]
str_inp = lambda : stdin.readline().strip()

def solve(a, n):
	while min(a) > 0:
		for i in range(n):
			a[i] -= 1
		if max(a) == min(a):
			return 'YES'
		elif max(a) == 1:
			return 'NO'
		for i in range(n):
			if not a[i]:
				a[i] += 2
for _ in range(int_inp()):
	n = int_inp()
	a = lst_inp()
	print(solve(a, n))


for ii in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ma = max(a)
	temp = 0
	for i in range(n):
		if a[i] == ma:
			pass
		elif (ma - a[i]) % 2 == 0:
			pass
		else:
			temp = 1
			break
	if temp == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	n = int(input())
	nos = list(map(int, input().split()))
	n_even = 0
	n_odd = 0
	for ns in nos:
		if ns % 2 == 0:
			n_even += 1
		else:
			n_odd += 1
	if n_even != 0 and n_odd != 0:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	parity = lst[0] % 2
	for num in lst:
		if num % 2 != parity:
			print('NO')
			break
	else:
		print('YES')


N = int(input())
for _ in range(N):
	n = int(input())
	lst = list(map(int, input().split()))
	ans = lst[0] % 2
	can = True
	for i in lst:
		if i % 2 != ans:
			print('NO')
			can = False
			break
	if can:
		print('YES')


for _ in range(int(input())):
	input()
	data = list(map(int, input().split()))
	depth = max(data)
	parities = [(depth - v) % 2 for v in data]
	psum = sum(parities)
	if psum % 2 == 1:
		print('NO')
		continue
	if sum((p == parities[0] for p in parities)) == len(parities):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	m = 0
	for x in l:
		if x % 2 == 0:
			m += 1
	print('YES' if m == 0 or m == n else 'NO')


from sys import stdin
input()
for (_, line) in zip(*[iter(stdin)] * 2):
	arr = list(map(int, line.split()))
	M = max(arr)
	flag = all(map(lambda x: (M - x) % 2 == 0, arr))
	print('YES' if flag else 'NO')


def isAllEven(initialColumns):
	for i in initialColumns:
		if i % 2 != 0:
			return False
	return True

def isAllOdd(initialColumns):
	for i in initialColumns:
		if i % 2 == 0:
			return False
	return True

def canFinilize(nColum, initialColumns):
	if nColum <= 1:
		return True
	elif initialColumns[0] % 2 == 0:
		return isAllEven(initialColumns)
	else:
		return isAllOdd(initialColumns)
t = int(input())
for i in range(t):
	nColum = int(input())
	initialColumns = [int(x) for x in input().split()]
	if canFinilize(nColum, initialColumns):
		print('YES')
	else:
		print('NO')


p = int(input())
for q in range(p):
	n = int(input())
	entrada = list(map(int, input().split(' ')))
	entrada.sort()
	flag = 0
	for k in range(n - 1):
		if (entrada[k] - entrada[k + 1]) % 2 != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for inh in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	od = False
	ev = False
	if a[0] % 2 == 0:
		ev = True
	else:
		od = True
	ans = True
	if ev:
		for i in range(0, n):
			k = a[i]
			if k % 2 != 0:
				ans = False
				break
	if od:
		for i in range(0, n):
			k = a[i]
			if k % 2 == 0:
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for T in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	(c, mn) = (0, min(l))
	for i in range(n):
		if (l[i] - mn) % 2 == 1:
			c = -1
			break
	if c == -1:
		print('NO')
	else:
		print('YES')


from collections import *
for i in range(int(input())):
	(n, a) = (int(input()), sorted(map(int, input().split())))
	odd = len(list(filter(lambda x: x % 2, a)))
	print('YES' if odd == n or odd == 0 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	min_a = min(a)
	flag = True
	for i in range(n):
		if (a[i] - min_a) % 2 == 0:
			continue
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = 0
	for i in range(1, n):
		if a[0] % 2 == 0:
			if a[i] % 2 == 0:
				pass
			else:
				f = 1
				break
		elif a[0] % 2 != 0:
			if a[i] % 2 != 0:
				pass
			else:
				f = 1
				break
	if f == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	x = [*map(int, input().split())]
	b = -1
	succ = True
	for i in x:
		if b == -1:
			b = i % 2
		elif b != i % 2:
			print('NO')
			succ = False
			break
	if succ:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(x, y) = (0, 0)
	for i in l:
		if i % 2 == 0:
			x += 1
		else:
			y += 1
	if x == 0 or y == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flag_even = True
	flag_odd = True
	for e in l:
		if e % 2 == 0:
			continue
		else:
			flag_even = False
			break
	for e in l:
		if e % 2 != 0:
			continue
		else:
			flag_odd = False
			break
	if flag_even or flag_odd:
		print('YES')
	else:
		print('NO')


from sys import *
from math import *
from collections import deque
input = stdin.readline
lmi = lambda : list(map(float, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for i in range(int(input())):
	n = int(input())
	arr = lmi()
	m = max(arr)
	tmp = m % 2
	bad = False
	for j in range(n):
		if arr[j] % 2 != tmp:
			bad = True
	print('YES' if not bad else 'NO')


t = int(input())

def solve(n, nums):
	mx = max(nums)
	for i in nums:
		if (mx - i) % 2 == 1:
			return False
	return True
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	print('YES' if solve(n, nums) else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = input().split(' ')
	for p in range(n):
		s[p] = int(s[p])
	modu = s[0] % 2
	som = False
	for k in range(n):
		if s[k] % 2 != modu:
			print('NO')
			som = True
			break
	if not som:
		print('YES')


T = int(input())
for _ in range(T):
	N = int(input())
	L = list(map(int, input().split()))
	if all((l % 2 == L[0] % 2 for l in L)):
		print('YES')
	else:
		print('NO')


a = int(input())
while a:
	n = int(input())
	ok1 = 0
	ok2 = 0
	x = list(map(int, input().split()))
	while n:
		if x[n - 1] & 1:
			ok1 = 1
		else:
			ok2 = 1
		n = n - 1
	if ok1 and ok2:
		print('No')
	else:
		print('Yes')
	a = a - 1


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = min(l)
	l = [i - m for i in l]
	can = True
	for k in l:
		if k == 0:
			continue
		if k % 2 == 1:
			can = False
			break
	if can:
		print('YES')
	else:
		print('NO')


import math as m

def f1():
	Testcases = int(input())
	for i in range(0, Testcases):
		Columns = int(input())
		InAi = [int(j) for j in input().split(' ')]
		Oddf = False
		Evenf = False
		for k in InAi:
			if k % 2 == 0:
				Evenf = True
			else:
				Oddf = True
			if Oddf == True and Evenf == True:
				print('NO')
				break
		if Oddf == False or Evenf == False:
			print('YES')
f1()


def solve(n, a):
	s = set()
	even = 0
	odd = 0
	for x in a:
		if x % 2 == 0:
			even += 1
		else:
			odd += 1
	if even and odd:
		return 'NO'
	else:
		return 'YES'
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
	t -= 1


def solve(n, a):
	for i in range(n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) % 2 != 0:
				return 'NO'
	return 'YES'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(i) for i in input().split()]
		print(solve(n, a))
main()


def solvable(n, blocks):
	blocks.sort()
	for i in range(n):
		for j in range(i + 1, n):
			if (blocks[j] - blocks[i]) % 2 != 0:
				return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	blocks = [int(i) for i in input().split()]
	if solvable(n, blocks):
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, input().split(' ')))
		odd_count = False
		mn = min(l)
		for i in l:
			if i != 0:
				if (i - mn) % 2 == 0:
					continue
				else:
					odd_count = True
					break
		if odd_count and n > 1:
			print('No')
		else:
			print('Yes')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	lst = tuple(map(int, input().split()))
	f = True
	for i in range(n - 1):
		if abs(lst[i] - lst[i + 1]) % 2:
			print('NO')
			f = False
			break
	if f:
		print('YES')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = map(int, input().split())
		a = sorted(a)
		f = 0
		for j in range(n - 1):
			if (a[j + 1] - a[j]) % 2 != 0:
				print('NO')
				f = 1
				break
		if f == 0:
			print('YES')
main()


f = int(input())
for i in range(f):
	g = int(input())
	fg = [int(x) for x in input().split()]
	d = 0
	f = 0
	for i in fg:
		if i % 2 != 0:
			d += 1
		else:
			f += 1
	if d and f:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(1, n):
		if arr[i] - arr[i - 1] & 1:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	print(solve())


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	b = 1
	for i in a:
		i -= m
		if i % 2:
			b = 0
	if b:
		print('YES')
	else:
		print('NO')


def one():
	return int(input())

def more():
	return list(map(int, input().split()))
for _ in range(one()):
	n = one()
	l = list(more())
	s = 0
	for i in l:
		s += i % 2
	if s % n == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	ne = 0
	a.sort()
	flag = 0
	for i in range(n - 1):
		if (a[i + 1] - a[i]) % 2 != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


def yesno(numColunas, entrada):
	if numColunas == 0:
		return 'YES'
	valoresAltura = [int(val) for val in entrada]
	alturaMax = max((int(number) for number in valoresAltura))
	if alturaMax == 0:
		return 'YES'
	posVazias = []
	for i in range(len(valoresAltura)):
		valor = alturaMax - valoresAltura[i]
		if valor % 2 != 0:
			return 'NO'
		posVazias.append(valor)
	if sum(posVazias) % 2 != 0:
		return 'NO'
	for i in range(len(posVazias)):
		if posVazias[i] != 0:
			while posVazias[i] != 0:
				posVazias[i] -= 2
	if max((int(number) for number in posVazias)) == 0:
		return 'YES'
	else:
		return 'NO'
numTestes = int(input())
lista = []
for i in range(numTestes):
	numColunas = int(input())
	entrada = str(input()).split(' ')
	lista.append(yesno(numColunas, entrada))
for i in lista:
	print(i)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(item) for item in input().split()]
	mod2 = [0] * 2
	for item in a:
		mod2[item % 2] += 1
	if 0 in mod2:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0, 0]
	for x in a:
		b[x % 2] += 1
	if min(b) > 0:
		print('no')
	else:
		print('yes')


def solve(n, a):
	mn = min(a)
	a = [i - mn for i in a]
	for i in a:
		if i % 2:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(i) for i in input().split()]
		print(solve(n, a))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	v = list(map(int, input().split()))
	odd = 0
	for i in v:
		if i & 1:
			odd += 1
	if odd == n or odd == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for x in range(n):
	t = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	for tp in range(t - 1):
		if (l[-1] - l[tp]) % 2 != 0:
			print('NO')
			break
		elif tp == t - 2:
			print('YES')
	if len(l) == 1:
		print('YES')


import sys
inp = sys.stdin.readline
ans = ''
for _ in range(int(inp())):
	n = int(inp())
	arr = list(map(int, inp().split()))
	par = arr[0] % 2
	flag = 1
	for i in arr:
		if i % 2 != par:
			flag = 0
			break
	if flag:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		if N == 1:
			print('YES')
			continue
		ma = max(A)
		x = 0
		f = True
		for a in A:
			if (ma - a) % 2 != 0:
				f = False
		if f:
			print('YES')
		else:
			print('NO')
main()


n = int(input())
for i in range(n):
	input()
	a = list(map(int, input().split()))
	eval_flg = False
	odd_flg = False
	for j in a:
		if j % 2 == 0:
			eval_flg = True
		else:
			odd_flg = True
	if eval_flg and odd_flg:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	(allodd, alleven) = (True, True)
	for i in array:
		if i % 2 == 0:
			allodd = False
		else:
			alleven = False
	if allodd or alleven:
		print('YES')
	else:
		print('NO')


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
for _ in range(int(z())):
	n = int(z())
	l = sorted(list(map(int, z().split())))
	o = 0
	e = 0
	for i in l:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if e == n or o == n:
		print('YES')
	else:
		print('No')


import sys

def solve():
	sys.stdin.readline().rstrip('\n')
	arr = sys.stdin.readline().rstrip('\n').split(' ')
	arr = [int(_) for _ in arr]
	res = 0
	for x in arr:
		if x % 2 == 0:
			res += 1
	if res == 0 or res == len(arr):
		print('YES')
	else:
		print('NO')
T = int(sys.stdin.readline().rstrip('\n'))
for i in range(T):
	solve()


t = int(input())
for i in range(t):
	input()
	a = map(int, input().split())
	cnt1 = 0
	cnt2 = 0
	for j in a:
		if j % 2 == 0:
			cnt1 += 1
		else:
			cnt2 += 1
	if cnt1 == 0 or cnt2 == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
b = 0
while b < a:
	c = int(input())
	arr = list(map(int, input().split()))
	key = 2
	error = 0
	for x in arr:
		if key == 2:
			if x % 2 == 0:
				key = 1
			else:
				key = 0
		elif key == 0:
			if x % 2 == 0:
				error = 1
		elif x % 2 == 1:
			error = 1
	if error == 1:
		print('NO')
	else:
		print('YES')
	b += 1


n = int(input())
for k in range(n):
	col = int(input())
	hlist = [int(i) for i in input().split()]
	can = True
	maxh = max(hlist)
	for y in hlist:
		if (maxh - y) % 2 != 0:
			can = False
	if can:
		print('YES')
	else:
		print('NO')


def out(list):
	l = []
	q = []
	c = 0
	s = 0
	for i in list:
		l.append(int(i))
	for j in l:
		s = min(l)
		if j - s != 0:
			q.append(j - s)
	for p in q:
		if p != 0 and p % 2 != 0:
			print('NO')
			break
		c = c + 1
	if c == len(q):
		print('Yes')
t = int(input())
for x in range(t):
	n = int(input())
	list = input().split()
	out(list)


for j in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	c = 0
	for i in range(len(b) - 1):
		if b[i] % 2 != b[i + 1] % 2:
			c += 1
			break
	print(['YES', 'NO'][c == 1])


def TetrisProblem(a, l):
	c = 0
	d = min(a)
	for i in range(l):
		a[i] = a[i] - d
	for i in range(l):
		if a[i] == 0:
			c += 1
		elif a[i] % 2 == 0:
			c += 1
	if l == c:
		return 'YES'
	else:
		return 'NO'
n = int(input())
for i in range(n):
	length = int(input())
	arr = list(map(int, input().rstrip().split()))
	print(TetrisProblem(arr, length))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	x = a[0] % 2
	flag = True
	for j in a:
		if j % 2 != x:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	m = int(input())
	a = list(map(int, input().split()))
	check = True
	for j in range(m - 1):
		if abs(a[j] - a[j + 1]) % 2 == 1:
			check = False
	if check == False:
		print('NO')
	else:
		print('YES')


def main():
	cases = int(input())
	for _ in range(cases):
		n = int(input())
		nums = sum(list(map(lambda x: int(x) % 2, input().split())))
		if nums == 0 or nums == n:
			print('YES')
		else:
			print('NO')
main()


cases = int(input())
for case in range(cases):
	columns = int(input())
	heights = list(map(lambda x: int(x), input().split()))
	minimum = min(heights)
	Possible = True
	for i in range(len(heights)):
		heights[i] -= minimum
	for item in heights:
		if item % 2 != 0:
			Possible = False
			break
	if Possible:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	a = max(l)
	c = 0
	for i in range(n):
		if abs(l[i] - a) % 2 != 0:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	check = a[0]
	flag = 0
	for k in range(1, n):
		if abs(check - a[k]) % 2 == 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	s = int(input())
	n = [int(__) for __ in input().split()]
	for i in n:
		if i % 2 != n[0] % 2:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = sorted(list(map(int, stdin.readline().split())))
	if n == 1:
		print('YES')
	else:
		cond = True
		for i in range(n - 1):
			if (arr[i + 1] - arr[i]) % 2 != 0:
				cond = False
				break
		if cond == True:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	for i in a:
		x += i % 2
	if x == 0 or x == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = input()
	n = int(n)
	A = list(input().split(' '))
	L = [int(x) for x in A]
	Ans = 0
	o = 0
	e = 0
	for i in range(n):
		if L[i] % 2 == 0:
			e = 1
		else:
			o = 1
		if o == 1 and e == 1:
			Ans = 1
			break
	if Ans == 1:
		print('NO')
	else:
		print('YES')


test_cases = int(input())
cases_n = []
cases_list = []
for i in range(test_cases):
	cases_n.append(int(input()))
	cases_list.append(input().split(' '))

def verify_tetris(n, case):
	maximum = int(case[0])
	valid = True
	for i in range(n):
		if int(case[i]) > maximum:
			maximum = int(case[i])
	for j in range(n):
		if int(case[j]) % 2 != maximum % 2:
			valid = False
			print('NO')
			return
	print('YES')
for i in range(test_cases):
	verify_tetris(cases_n[i], cases_list[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	ans = True
	for i in range(n):
		if a[i] != mx:
			if (mx - a[i]) % 2 != 0:
				ans = False
				break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	for i in range(len(a)):
		a[i] -= m
	if all((i % 2 == 0 for i in a)) == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	ans = 'YES'
	n = int(input())
	a = list(map(int, input().split()))
	mn = min(a)
	for i in range(n):
		a[i] = a[i] - mn
	for i in range(n):
		if a[i] % 2 != 0:
			ans = 'NO'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	blocks = [int(i) for i in input().split()]
	mod = blocks[0] % 2
	ans = False
	for j in blocks:
		if mod != j % 2:
			ans = True
			break
	if ans:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		(even, odd) = (0, 0)
		maxx = max(a)
		minn = min(a)
		for i in range(n):
			if a[i] % 2 == 0:
				even += 1
			else:
				odd += 1
		if odd > 0 and even > 0:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):

	def Check(square: list):
		repeat = True
		while repeat:
			completion = len(square)
			for val in square:
				if val >= 1:
					completion -= 1
				else:
					repeat = False
					break
			if not completion:
				minimum = min(square)
				for i in range(len(square)):
					square[i] -= minimum
			else:
				break
		completion = len(square)
		for val in square:
			if val:
				return True
			else:
				completion -= 1
		if not completion:
			print('YES')
			return False

	def Place(square: list, highest: int):
		indexes = []
		for (i, val) in enumerate(square):
			diff = highest - val
			if diff >= 2:
				if diff % 2 == 0:
					square[i] += diff
				else:
					square[i] += 2
				return True
			else:
				indexes.append((i, diff))
		if len(indexes) != 0 and max(indexes, key=func)[1] < 2:
			return False
		else:
			to_add = max(indexes, key=func)
			square[to_add[0]] = to_add[1]
			return True
	input()
	func = lambda x: x[1]
	func1 = lambda diff: [diff for _ in range(1) if diff / 2 % 2 == 0]
	matrix = [int(s) for s in input().split(' ')]
	diff0 = True
	if matrix.count(matrix[0]) == len(matrix):
		print('YES')
	else:
		while diff0:
			if not Place(matrix, max(matrix)):
				print('NO')
				break
			diff0 = Check(matrix)


n = int(input())
Result = []
for i in range(0, n):
	len_ = int(input())
	List = list(map(int, input().strip().split()))[0:len_]
	count = 0
	for i in List:
		if i % 2 != 0:
			count += 1
	if count == len_ or count == 0:
		Result.append('YES')
	else:
		Result.append('NO')
for i in Result:
	print(i)


from math import *
t = int(input())
for zz in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	o = 0
	e = 0
	for i in a:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if o > 0 and e > 0:
		print('NO')
	else:
		print('YES')


T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr = sorted(arr)
	state = 'YES'
	for i in range(1, len(arr)):
		if (arr[i] - arr[i - 1]) % 2 != 0:
			state = 'NO'
			break
	print(state)


T = int(input())
for case in range(T):
	rows = int(input())
	state = [int(x) % 2 for x in input().split()]
	if 0 in state and 1 in state:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	f = a[0] % 2
	ok = True
	for i in range(1, n):
		if a[i] % 2 != f:
			ok = False
			break
	if not ok:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(('NO', 'YES')[all([a[0] & 1 == a[i] & 1 for i in range(n)])])


local = False
if local:
	file = open('A.txt', 'r')

def IN():
	if local:
		return file.readline()
	else:
		return input()

def solve(arr):
	even = arr[0] % 2 == 0
	for j in range(1, len(arr)):
		jeven = arr[j] % 2 == 0
		if even != jeven:
			return 'NO'
	return 'YES'
t = int(IN())
for i in range(t):
	n = int(IN())
	arr = [int(_) for _ in IN().split()]
	print(solve(arr))


t = int(input())
for c in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort(reverse=True)
	for i in range(1, len(l)):
		if (l[0] - l[i]) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	(odd, even) = (False, False)
	for x in a:
		if x % 2 == 0:
			even = True
		else:
			odd = True
	if odd and even:
		print('NO')
	else:
		print('YES')
t = int(input())
for _ in range(t):
	solve()


n = int(input())
for i in range(n):
	k = int(input())
	a = [int(i) for i in input().split()]
	for j in range(k):
		if (max(a) - a[j]) % 2 == 0:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


def gandGobi(n, arr):
	b = 0
	for i in range(1, n):
		if arr[i - 1] % 2 != arr[i] % 2:
			b = 1
			break
	if b == 0:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	gandGobi(n, arr)


def check_equal(array):
	maximum = max(array)
	dic = {}
	dic[maximum] = 1
	for i in range(len(array)):
		if array[i] == 0:
			continue
		if array[i] not in dic:
			return False
	if maximum % 2 == 0:
		return True
	else:
		return False

def take_out(array):
	minimum = min(array)
	if minimum == 0:
		return array
	else:
		for i in range(len(array)):
			array[i] = array[i] - minimum
		return array

def check_odd(array):
	for i in range(len(array)):
		if array[i] % 2 != 0:
			return True
	return False

def tetris_problem():
	cases = int(input())
	length = []
	tetris = []
	for i in range(cases):
		length.append(int(input()))
		tetris.append(list(map(int, input().split())))
	for i in range(len(length)):
		if length == 1:
			print('YES')
			continue
		tetris[i] = take_out(tetris[i])
		if check_equal(tetris[i]):
			print('YES')
		elif check_odd(tetris[i]):
			print('NO')
		else:
			print('YES')
tetris_problem()


t = int(input())
res = []
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(even_count, odd_count) = (0, 0)
	for num in l:
		if num % 2 == 0:
			even_count += 1
		else:
			odd_count += 1
	if even_count == 0 or odd_count == 0:
		res.append('YES')
	else:
		res.append('NO')
for s in res:
	print(s)


t = int(input())
for i in range(t):
	a = int(input())
	t = 0
	x = [int(g) for g in input().split()]
	if len(x) > 1:
		for g in range(len(x) - 1):
			d = abs(x[g] - x[g + 1])
			if d % 2 != 0:
				t = 1
				print('NO')
				d = 0
				break
		if t == 0:
			print('YES')
			d = 0
			t = 0
	else:
		print('YES')


def I():
	return list(map(int, input().split()))
for __ in range(int(input())):
	n = input()
	x = I()
	odd = 0
	even = 0
	for i in x:
		if i % 2:
			odd = 1
		else:
			even = 1
	print('NO') if odd and even else print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n - 1):
		if (a[i] - a[i + 1]) % 2 == 1:
			flag = 1
	if flag == 1:
		print('No')
	else:
		print('Yes')


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
	elif l[0] % 2 == 1:
		flag = 0
		for i in range(1, n):
			if l[i] % 2 != 1:
				print('NO')
				flag = 1
				break
		if flag == 0:
			print('YES')
	elif l[0] % 2 != 1:
		flag = 0
		for i in range(1, n):
			if l[i] % 2 == 1:
				print('NO')
				flag = 1
				break
		if flag == 0:
			print('YES')
	t -= 1


a = int(input())
for x in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	if b == 1:
		print('YES')
	else:
		t = []
		for y in range(b - 1):
			for z in range(y, b):
				t.append(abs(c[y] - c[z]))
		h = 0
		for n in t:
			if n % 2 == 0:
				h += 1
			else:
				break
		if h == len(t):
			print('YES')
		else:
			print('NO')


t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	s = 0
	for i in l:
		s += i % 2
	if s > 0 and s < n:
		print('NO')
	else:
		print('YES')


t = int(input())
count = 0
ans = []
while count < t:
	x = int(input())
	n = list(map(int, input().split()))
	eve = [g for g in n if g % 2 == 0]
	if len(eve) > 0 and len(eve) == x:
		ans.append('YES')
	elif len(eve) > 0:
		ans.append('NO')
	elif len(eve) == 0:
		ans.append('YES')
	else:
		ans.append('NO')
	count += 1
for y in ans:
	print(y)


x = int(input())
for i in range(x):
	tamanho = int(input())
	colunas = list(map(int, input().split()))
	colunas.sort()
	flag = False
	if tamanho > 1:
		for a in range(1, tamanho):
			if (colunas[a] - colunas[a - 1]) % 2 == 1:
				print('NO')
				flag = True
				break
		if flag == False:
			print('YES')
	else:
		print('YES')


import sys
answer = []
num_cases = int(input())
answers = []
for i in range(0, num_cases):
	str = input()
	cols = int(str)
	map = input()
	map = map.split()
	a = []
	max = -1
	for num in map:
		to_ap = int(num)
		if to_ap >= max:
			max = to_ap
		a.append(to_ap)
	no = 0
	for i in a:
		if (max - i) % 2 != 0:
			no = 1
			answers.append('NO')
			break
	if no == 0:
		answers.append('YES')
for an in answers:
	print(an)


def func(list_a):
	max_num = max(list_a)
	for i in list_a:
		if (max_num - i) % 2 != 0:
			print('NO')
			return 0
	print('YES')
	return 1
t = int(input())
for i in range(t):
	n = input()
	list_a = input().split(' ')
	list_a_int = [int(x) for x in list_a]
	func(list_a_int)


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	(even, odd) = (0, 0)
	for j in range(n):
		if x[j] % 2 == 0:
			even += 1
		else:
			odd += 1
	if even > 0 and odd > 0:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	ai = list(map(int, input().split()))
	a = 0
	for j in ai:
		a += j % 2
	if a == 0 or a == n:
		print('YES')
	else:
		print('NO')


def solver(arr, N):
	for i in range(1, N):
		if arr[0] & 1 == 1:
			if arr[i] & 1 != 1:
				return 'NO'
		elif arr[i] & 1 != 0:
			return 'No'
	return 'YES'
for i in range(int(input())):
	N = int(input())
	arr = list(map(int, input().split()))
	print(solver(arr, N))


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	lst = list(map(int, input().split()))
	if n > 1:
		parity = lst[0] % 2
		for el in lst:
			if el % 2 != parity:
				ans = 'NO'
				break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if a[0] % 2 == 0:
		k = 0
	else:
		k = 1
	bool = True
	for x in a:
		if (x + k) % 2 != 0:
			print('NO')
			bool = False
			break
	if bool:
		print('YES')


testcases = int(input())
for testcase in range(testcases):
	col = int(input())
	if col == 1:
		getarr = str(input())
		print('YES')
		continue
	odd = 0
	even = 0
	getarr = str(input())
	arr = getarr.split()
	for i in arr:
		g = int(i)
		if g & 1 == 0:
			even += 1
		else:
			odd += 1
	if odd != 0 and even != 0:
		print('NO')
	else:
		print('YES')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		lst = list(map(int, input().split()))
		odd = False
		even = False
		ans = True
		for ele in lst:
			if ele % 2 == 0:
				even = True
				if odd:
					ans = False
					break
			else:
				odd = True
				if even:
					ans = False
					break
		if ans:
			yield 'YES'
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	flag = 0
	for i in range(1, N):
		if A[i] - A[i - 1] == 0 or (A[i] - A[i - 1]) % 2 == 0:
			continue
		else:
			flag = 1
			break
	print('YES') if flag == 0 else print('NO')


t = int(input())
ans = []
for h in range(t):
	ans.append('YES')
for i in range(t):
	mas = []
	n = int(input())
	mas = list(map(int, input().split()))
	d = 0
	for x in range(n):
		if x == 0:
			d = mas[x] % 2
		if x == n - 1:
			if mas[x] % 2 != d:
				ans[i] = 'NO'
				break
			else:
				ans[i] = 'YES'
				break
		elif mas[x] % 2 != d:
			ans[i] = 'NO'
			break
for b in range(t):
	print(ans[b])


from sys import stdin

def solve(n, a):
	k = max(a)
	ans = 'YES'
	for i in a:
		if (k - i) % 2 == 0:
			continue
		else:
			ans = 'NO'
			break
	print(ans)

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		a = list(map(int, inp().split()))
		solve(n, a)
main()


test = int(input())
for index in range(0, test):
	num = int(input())
	values = input().split()
	value = [int(index1) for index1 in values]
	node = 0
	root = 0
	maximum = max(value)
	for iterate in range(0, num):
		result = maximum - value[iterate]
		if result % 2 == 0:
			node = node + 1
		else:
			root = root + 1
	if node > 0 and root == 0:
		print('YES')
	elif node == 0 and root == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = input()
	l = [int(i) for i in input().split()]
	rem = l[0] % 2
	temp = 0
	for e in l[1:]:
		if e % 2 != rem:
			temp = 1
			break
	if temp == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = int(input())
	b = 0
	l = list(map(int, input().split()))
	if len(l) == 1:
		print('YES')
		continue
	for j in range(len(l) - 1):
		if (l[j + 1] - l[j]) % 2 == 0:
			b += 1
	if b == len(l) - 1:
		print('YES')
	else:
		print('NO')


for _ in [0] * int(input()):
	n = int(input())
	a = list(map(int, input().split()))
	(k, kk) = (False, False)
	for i in a:
		if i % 2 != 0:
			k = True
		else:
			kk = True
		if k and kk:
			break
	if k and kk:
		print('NO')
	else:
		print('YES')


t = int(input())
for j in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	s = min(lista)
	count = 0
	for i in range(len(lista)):
		lista[i] = lista[i] - s
	for i in lista:
		if i % 2 != 0:
			print('NO')
			count = 1
			break
	if count == 0:
		print('YES')


t = int(input())
for l in range(t):
	n = int(input())
	e = 0
	o = 0
	c = 0
	a = input().split()
	for i in a:
		if int(i) % 2 == 0:
			e += 1
			if o > 0:
				print('NO')
				c = 1
				break
		else:
			o += 1
			if e > 0:
				print('NO')
				c = 1
				break
	if c == 0:
		print('YES')


for i in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	(even, odd) = (0, 0)
	for j in lst:
		if j % 2 == 0:
			even = 1
		else:
			odd = 1
		if even == 1 and odd == 1:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	flag = 0
	for i in range(len(b) - 1):
		if abs(b[i] - b[i + 1]) % 2 != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	l = list(map(int, input().rstrip().split()))
	(D, P) = (0, 0)
	for el in l:
		if el % 2:
			D += 1
		else:
			P += 1
	if D == n or P == n:
		print('YES')
	else:
		print('NO')


from sys import stdin
from math import ceil
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	even = False
	odd = False
	for i in range(n):
		if a[i] % 2 == 0:
			even = True
		else:
			odd = True
		if even and odd:
			print('no')
			break
	else:
		print('yes')


cases = int(input())
while cases > 0:
	arr = []
	n = int(input())
	arr = list(map(int, input().split()))
	mini = min(arr)
	for i in range(0, n, 1):
		arr[i] -= mini
	can = True
	for i in range(0, n, 1):
		if arr[i] % 2 == 1:
			can = False
			break
	if can == True:
		print('YES')
	else:
		print('NO')
	cases -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = set([i % 2 for i in a])
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	b = True
	c = [int(x) for x in input().split()]
	a = c[0] % 2
	for j in range(len(c)):
		if c[j] % 2 != a:
			print('NO')
			b = False
			break
	if b:
		print('YES')


t = input()
list_no_of_columns = []
List_blocks_in_col = []
op_list = []
Prev_parity = 0
parity = 0
flag = 0
for i in range(2 * int(t)):
	if i % 2 == 0:
		list_no_of_columns.append(input())
	else:
		List_blocks_in_col.append(input())
for i in range(int(t)):
	flag = 0
	no_0f_colums = int(list_no_of_columns[i])
	str_block_col = List_blocks_in_col[i]
	Tetris_Field = []
	list_split_str_block = str_block_col.split()
	for j in range(no_0f_colums):
		Tetris_Field.append([])
		for k in range(int(list_split_str_block[j])):
			Tetris_Field[j].append(k)
	length = len(Tetris_Field[0])
	Prev_parity = len(Tetris_Field[0]) % 2
	for i in Tetris_Field:
		len_Column = len(i)
		parity = len_Column % 2
		if Prev_parity != parity:
			flag = 1
			break
		Prev_parity = parity
	if flag == 1:
		op_list.append('NO')
	else:
		op_list.append('YES')
for i in range(len(op_list)):
	print(op_list[i])


I = input
exec(int(I()) * 'I();print("YNEOS"[set(map(lambda x:int(x)&1,I().split()))>{1}::2]);')


q = int(input())
for ii in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	mn = min(a)
	for i in range(n):
		a[i] = a[i] - mn
	f = 0
	for i in range(n):
		if a[i] % 2:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
a = []
for i in range(n):
	t = input()
	b = list(map(int, input().split()))
	a.append(b)
for i in a:
	if len(i) == 1:
		print('YES')
	else:
		p = i[0] % 2
		q = 0
		for j in range(len(i)):
			if i[j] % 2 != p:
				print('NO')
				q = 1
				break
		if q == 0:
			print('YES')


test_case = int(input())
while test_case:
	n = int(input())
	list = input().split(' ')
	maxi = int(max(list))
	bool = 'True'
	for i in list:
		if (maxi - int(i)) % 2 != 0:
			bool = False
	if bool:
		print('Yes')
	else:
		print('No')
	test_case -= 1


q = int(input())
for _ in range(q):
	n = int(input())
	t = list(map(int, input().split()))
	minV = min(t)
	flag = 0
	for i in range(n):
		t[i] -= minV
		if t[i] % 2 == 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	count = [0, 0]
	for i in range(len(li)):
		count[li[i] % 2] += 1
	if count[0] and count[1]:
		print('NO')
	else:
		print('YES')


def test():
	n = int(input())
	arr = []
	string = input()
	for num in string.split(' '):
		arr.append(int(num))
	for el in arr:
		if el % 2 != arr[0] % 2:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(0, t):
	test()


n1 = int(input())
for i in range(n1):
	n = int(input())
	li = list(map(int, input().split()))
	if all((k % 2 == 0 for k in li)) == True or all((k1 % 2 != 0 for k1 in li)) == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = set((int(x) % 2 for x in input().split()))
	print('YES' if len(s) == 1 else 'NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	odd = 0
	even = 0
	flag = 0
	for i in arr:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
		if odd >= 1 and even >= 1:
			print('NO')
			flag = 1
			break
	if flag == 1:
		continue
	if odd == n or even == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 1:
		print('YES')
		continue
	else:
		par = a[0] % 2
		yep = False
		for i in range(len(a)):
			if a[i] % 2 != par:
				print('NO')
				yep = True
				break
		if not yep:
			print('YES')


t = int(input())

def intmaker(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr

def sameParity(arr):
	even = 0
	odd = 0
	for i in range(len(arr)):
		if a[i] % 2 == 1:
			odd += 1
		else:
			even += 1
	if even == len(arr) or odd == len(arr):
		return True
	else:
		return False
for i in range(t):
	n = int(input())
	a = intmaker(input().split())
	if sameParity(a):
		print('YES')
	else:
		print('NO')


for __ in range(int(input())):
	n = int(input())
	arr = [int(s) for s in input().split()]
	m = arr[0] & 1
	if sum((i & 1 ^ m for i in arr)) == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	stt = 0
	for i in a:
		if (max(a) - i) % 2 == 1:
			stt = 1
			break
	print('YNEOS'[stt::2])


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	bool = True
	if a[0] % 2 == 0:
		while bool:
			if a[i] % 2 != 0:
				print('NO')
				bool = False
			if i == n - 1:
				break
			i += 1
		if bool:
			print('YES')
	else:
		while bool:
			if a[i] % 2 == 0:
				print('NO')
				bool = False
			if i == n - 1:
				break
			i += 1
		if bool:
			print('YES')
	t = t - 1


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
for _ in range(ii()):
	n = ii()
	a = li()
	c = 0
	j = max(a)
	for i in range(n):
		a[i] = j - a[i]
		if a[i] % 2 == 0:
			c += 1
	if c == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	else:
		ans = True
		for aa in a:
			if aa % 2 != a[0] % 2:
				ans = False
		if ans:
			print('YES')
		else:
			print('NO')


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	array = list(map(int, sys.stdin.readline().split()))
	total = 0
	for number in array:
		if number % 2 == 0:
			total += 1
	if total == 0 or total == n:
		print('YES')
	else:
		print('NO')


def ans(l):
	k = list(set(l))
	return len(k)
t = int(input())
while t > 0:
	a = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if ans(l) == 1:
		print('YES')
	else:
		count = 0
		for i in range(0, a - 1, 1):
			f = l[a - 1] - l[i]
			if f % 2 == 0:
				count += 1
			else:
				count = 0
		if count + 1 == a or a == 1:
			print('YES')
		else:
			print('NO')
	t -= 1


testes = int(input())
resultados = []
while testes > 0:
	colunas = int(input())
	second_line = input().split()
	lista_num = list(map(int, second_line))
	maximo = max(lista_num)
	chave = True
	for i in range(colunas - 1, -1, -1):
		if (lista_num[i] - maximo) % 2 == 0:
			continue
		else:
			resultados.append('NO')
			chave = False
			break
	if chave == True:
		resultados.append('YES')
	testes = testes - 1
for i in range(len(resultados)):
	print(resultados[i])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	flag0 = 0
	flag1 = 0
	for k in a:
		if k % 2 != 0:
			flag0 = 1
		if k % 2 != 1:
			flag1 = 1
	if not flag0 or not flag1:
		print('YES')
	else:
		print('NO')


import sys
testcases = int(sys.stdin.readline())
for j in range(testcases):
	n = int(sys.stdin.readline())
	answer = 'NO'
	liste = list(map(int, sys.stdin.readline().split()))
	test = liste[0] % 2
	for i in liste:
		if i % 2 != test:
			break
	else:
		answer = 'YES'
	print(answer)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	m = min(a)
	for i in a:
		if (i - m) % 2 & 1:
			print('NO')
			break
	else:
		print('YES')


def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		parno = False
		neparno = False
		a = [int(i) for i in input().split()]
		for j in a:
			x = j
			if x % 2:
				neparno = True
			else:
				parno = True
		if parno and neparno:
			print('NO')
		else:
			print('YES')
		print('\n')
main()


def solve(n, a):
	ans = all([i % 2 == 0 for i in a]) or all([i % 2 == 1 for i in a])
	if ans:
		print('YES')
	else:
		print('NO')

def main():
	inp = lambda : [int(x) for x in input().split()]
	i = lambda : int(input())
	tc = i()
	for _ in range(tc):
		n = i()
		a = inp()
		solve(n, a)
main()


t = int(input())
while t:
	n = int(input())
	a = [int(x) for x in input().split()]
	s = a[0] % 2
	no = False
	for i in a:
		if i % 2 != s:
			print('NO')
			no = True
			break
	if not no:
		print('YES')
	t -= 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	if all((x % 2 == A[0] % 2 for x in A)):
		return 'YES'
	return 'NO'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


n = int(input())
for i in range(n):
	k = int(input())
	a = list(map(int, input().split()))
	h = max(a)
	res = ((h - ai) % 2 == 0 for ai in a)
	if all(res):
		print('YES')
	else:
		print('NO')


def func():
	n = int(input())
	al = list(map(int, input().split()))
	min_a = min(al)
	al = [i - min_a for i in al]
	for a in al:
		if a % 2 == 1:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for _ in range(t):
	func()


n = int(input())
res = []
for i in range(n):
	nn = int(input())
	x = list(map(int, input().split()))
	even = 0
	odd = 0
	for i in x:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == nn or odd == nn:
		res.append('YES')
	else:
		res.append('NO')
for i in res:
	print(i)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	z = 0
	for i in range(0, n - 1):
		y = a[i + 1] - a[i]
		if y % 2 == 1:
			z = 1
			break
		else:
			continue
	if z == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))[:n]
	o = 0
	e = 0
	for i in lst:
		if i % 2 == 0:
			e = e + 1
		else:
			o = o + 1
	if e == n or o == n:
		print('YES')
	else:
		print('NO')


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(ri()):
	n = ri()
	a = r()
	ans = [0, 0]
	for ai in a:
		ans[ai % 2] += 1
	if all(ans):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	lst = [int(x) & 1 for x in input().split()]
	c = lst.count(1)
	if c == 0 or c == n:
		print('YES')
	else:
		print('NO')


import sys
inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def check_seq(seq):
	for i in range(len(seq) - 1):
		for j in range(i + 1, len(seq)):
			if abs(seq[i] - seq[j]) % 2:
				return 'NO'
	return 'YES'

def main():
	n = read_one_int()
	for _ in range(n):
		cur_n = read_one_int()
		cur_seq = read_list_of_ints()
		if cur_n == 1:
			print('YES')
			continue
		print(check_seq(cur_seq))
main()


import math
n = int(input())
for i in range(n):
	N = int(input())
	ls = input().split()
	ls = list(map(int, ls))
	ls1 = []
	for j in range(len(ls)):
		if (ls[0] - ls[j]) % 2 == 0:
			ls1.append(0)
		else:
			ls1.append(1)
	if sum(ls1) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	f = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if abs(ar[j] - ar[i]) % 2 != 0:
				f = 1
				break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	mn = min(a)
	z = 0
	for j in a:
		j -= mn
		if j % 2 == 1:
			print('NO')
			z = 1
			break
	if z == 0:
		print('YES')


def rr():
	return input().rstrip()

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))
from collections import defaultdict

def mus(d=0):
	return defaultdict(defaultdict(d))

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def yn(x):
	return 'YES' if x else 'NO'

def rnar():
	return (rri(), rrl())

def r2nar():
	return (rri(), rri(), rrl())

def read():
	return rnar()

def is_odd(x):
	return x % 2 == 1

def solve(n, arr):
	m = min(arr)
	arr = list(map(lambda x: x - m, arr))
	answ = any(map(is_odd, arr))
	return yn(not answ)
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	print(result)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = input().split(' ')
	for j in range(0, n):
		a[j] = int(a[j])
	x = max(a)
	ans = True
	for y in a:
		if abs(x - y) % 2 != 0:
			ans = False
	if ans == True:
		print('Yes')
	else:
		print('NO')


numTests = int(input())
for _ in range(numTests):
	numCols = int(input())
	cols = [int(i) for i in input().split()]
	col1 = cols[0] % 2
	good = True
	for ii in range(1, numCols):
		if cols[ii] % 2 != col1:
			print('NO')
			good = False
			break
	if good:
		print('YES')


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = input().split(' ')
	a = int(s[0])
	ans = True
	for k in range(1, n):
		b = int(s[k])
		if abs(a - b) % 2 == 0:
			a = b
		else:
			ans = False
			break
	if ans:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(0, t):
	n = int(input())
	tetris = input().split()
	add = int(tetris[0]) % 2
	flag = 1
	if add == 0:
		for i in tetris:
			if int(i) % 2 == 1:
				print('NO')
				flag = 0
				break
	else:
		for i in range(0, len(tetris)):
			tetris[i] = int(tetris[i]) + 1
		for i in tetris:
			if int(i) % 2 == 1:
				print('NO')
				flag = 0
				break
	if flag == 1:
		print('YES')


t = int(input())
for case in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	f = True
	for i in range(0, n):
		if a[i] % 2 != a[0] % 2:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	flag = 0
	k = a[0] % 2
	for j in range(1, n):
		if a[j] % 2 != k:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	ans = 'YES'
	for i in range(1, n):
		if (a[i] - a[i - 1]) % 2 == 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	vals = list(map(int, input().split()))
	last_val = vals[0] % 2
	printed = False
	for v in vals[1:]:
		if v % 2 != last_val:
			print('NO')
			printed = True
			break
	if not printed:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	a = a[:n]
	a.sort()
	flag = 0
	for i in range(n - 1):
		if (a[i + 1] - a[i]) % 2:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')
	t -= 1


for j in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()][:n]
	c = max(a)
	go = True
	for k in a:
		if (k - c) % 2 != 0:
			go = False
			break
	if go:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	print('YNEOS'[len(set([int(x) % 2 for x in input().split()])) - 1::2])


def notPoss(h):
	for i in h:
		if abs(i - max(h)) % 2 != 0:
			return False
	return True
t = int(input())
for q in range(t):
	c = int(input())
	h = list(map(int, input().split()))
	print('YES') if notPoss(h) else print('NO')


from sys import stdin
for i in range(int(stdin.readline())):
	n = stdin.readline()
	L = list(map(int, stdin.readline().split()))
	k = min(L)
	(odd, even) = (0, 0)
	for i in range(len(L)):
		L[i] -= k
	for i in L:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd == len(L) or even == len(L):
		print('YES')
	else:
		print('NO')


queries = int(input())
for _ in range(queries):
	_ = input()
	array = [int(item) for item in input().split()]
	isEven = False
	isOdd = False
	isPossible = True
	for item in array:
		if item % 2 == 0:
			isEven = True
		if item % 2 != 0:
			isOdd = True
		if isEven and isOdd:
			isPossible = False
			break
	if isPossible:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	bisa = True
	prev = 0
	col = input()
	col = col.split(' ')
	col = [int(i) for i in col]
	for i in range(1, n):
		if abs(col[i] - col[i - 1]) % 2 == 1:
			bisa = False
			break
	if bisa:
		print('YES')
	else:
		print('NO')
	t -= 1


x = int(input())
for i in range(x):
	a = int(input())
	l = list(map(int, input().split()))
	k = max(l)
	s = 0
	for j in l:
		if (k - j) % 2 == 0:
			s += 1
		else:
			break
	if s == len(l):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	b = [1 if i % 2 == 0 else 0 for i in a]
	if b.count(1) > 0 and b.count(0):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	k = False
	if n > 1:
		for i in range(n - 1):
			diff = l[i + 1] - l[i]
			if diff % 2 != 0:
				k = True
				break
		if not k:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	mx = -1
	for x in l:
		mx = max(mx, x)
	flag = 1
	for x in l:
		if abs(x - -mx) % 2 == 0:
			pass
		else:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	print('YNEOS'[sum((int(i) % 2 for i in input().split())) % n != 0::2])


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	list_block = list(map(int, sys.stdin.readline().split()))
	a = list_block[0] % 2
	result = [i for i in list_block if not i % 2 == a]
	if result:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [int(_) for _ in input().split()]
	m = min(a)
	print('NO' if any(((_ - m) % 2 for _ in a)) else 'YES')


def abc(c):
	d = 0
	for i in range(n - 1):
		if (t[i + 1] - t[i]) % 2 == 0:
			d = d + 1
	return d
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		t = sorted(l)
		if abc(t) == n - 1:
			print('YES')
		else:
			print('NO')


T = int(input())
t = 0
while t < T:
	N = int(input())
	L = list(map(int, input().split()))
	out = True
	r = L[0] % 2
	n = 0
	while n < N:
		a = L[n]
		if a % 2 != r:
			out = False
			break
		n += 1
	if out:
		print('YES')
	else:
		print('NO')
	t += 1


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	even = True
	odd = True
	for i in a:
		if i % 2 == 0:
			odd = False
		else:
			even = False
	print('YES' if even or odd else 'NO')


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]

def is_possible(arr: list) -> bool:
	minim = min(arr)
	for i in range(len(arr)):
		arr[i] = arr[i] - minim
	if all_zero(arr):
		return True
	return all((el % 2 == 0 for el in arr))

def all_zero(arr):
	return all((el == 0 for el in arr))
(T,) = read_ints()
for test in range(T):
	(n,) = read_ints()
	arr = read_ints()
	ok = is_possible(arr)
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	j = 0
	k = 0
	for a in range(n):
		if l[a] % 2 == 0:
			j = j + 1
		else:
			k = k + 1
	if k == n or j == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	flag = 0
	for x in arr:
		if x % 2 != arr[0] % 2:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
n = int(stdin.readline())
for i in range(n):
	ans = 'YES'
	a = stdin.readline()
	lst = [int(i) for i in stdin.readline().split()]
	first = lst[0] % 2
	for i in lst[1:]:
		if first != i % 2:
			ans = 'NO'
			break
	stdout.write(ans + '\n')


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(i) % 2 for i in input().split()]
	print('YES' if max(A) == min(A) else 'NO')


n = int(input())
for i in range(n):
	m = int(input())
	X = input().split()
	a = int(X[0]) % 2
	for j in range(m):
		if a != int(X[j]) % 2:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for i in range(n):
	bool = True
	x = int(input())
	lst = input().split()
	max = int(lst[0])
	for i in lst:
		if int(i) > max:
			max = int(i)
	for i in lst:
		if (max - int(i)) % 2 != 0:
			print('NO')
			bool = False
			break
	if bool == True:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for i in l:
		if i & 1 == 0:
			c += 1
	if c == 0 or c == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = a[0] & 1
	for i in a:
		if i & 1 != f:
			print('NO')
			break
	else:
		print('YES')


l = int(input())
for _ in range(l):
	b = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	f = True
	for n in a:
		if (m - n) % 2 == 1:
			print('NO')
			f = False
			break
	if f:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	array = [int(x) % 2 for x in input().split()]
	if len(set(array)) == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	chet = a[0] % 2
	f = True
	for j in a:
		if j % 2 != chet:
			f = False
	if f:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		b = [0, 0]
		for x in a:
			b[x % 2] += 1
		print('YES' if b[0] == n or b[1] == n else 'NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def addBlock(board, block):
	board[block] += 2
	while 0 not in board:
		for i in range(len(board)):
			board[i] -= 1
	return

def checkColumns(board):
	num = board[0]
	for i in board:
		if num != i:
			return False
	return True

def checkBoard(board):
	if 0 in board and max(board) % 2 == 1:
		return 'NO'
	if checkColumns(board):
		return 'YES'
	elif board.count(1) == 1 and board.count(0) == len(board) - 1:
		return 'NO'
	board_hold = board[:]
	for i in range(len(board)):
		if 0 in board:
			if board[i] == 0:
				addBlock(board, i)
				if checkBoard(board) == 'YES':
					return 'YES'
		elif board[i] < 103:
			addBlock(board, i)
			if checkBoard(board) == 'YES':
				return 'YES'
		board = board_hold[:]
	return 'NO'
t = int(input())
ans = []
for i in range(t):
	num_colmns = int(input())
	board = list(map(int, input().split(' ')))
	while 0 not in board:
		for i in range(len(board)):
			board[i] -= 1
	for j in board:
		if j % 2 == 1:
			ans.append('NO')
			break
	else:
		ans.append('YES')
for i in ans:
	print(i)


t = int(input())
for _ in range(t):
	n = int(input())
	cols = [int(e) for e in input().split()]
	able = True
	for col in cols:
		if (max(cols) - col) % 2 != 0:
			able = False
	print('YES' if able else 'NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mn = min(a)
	for i in range(n):
		a[i] = a[i] - mn
	ch = 1
	for i in range(n):
		if a[i] % 2 == 1:
			ch = 0
			break
	if ch == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	c = int(input())
	arr = sum([i % 2 for i in list(map(int, input().split()))])
	if arr == 0 or arr == c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))[:n]
	(ec, oc) = (0, 0)
	for x in l:
		if x % 2 == 0:
			ec += 1
		else:
			oc += 1
	if ec == 0 or oc == 0:
		print('YES')
	else:
		print('NO')


def read():
	return list(map(int, input().split()))

def fun(arr, n):
	if n == 1:
		return 'YES'
	if len(set(arr)) == 1:
		return 'YES'
	m = max(arr)
	for i in range(n):
		if (m - arr[i]) % 2 != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = read()
	print(fun(arr, n))


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi
import math
from itertools import permutations

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		b = max(a)
		ans = 'YES'
		for i in range(n):
			if abs(a[i] - b) % 2:
				ans = 'NO'
				break
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	nums = [int(i) for i in input().strip().split()]
	has = True
	if nums[0] % 2 == 0:
		for i in range(1, n):
			if nums[i] % 2 != 0:
				has = False
				break
	else:
		for i in range(1, n):
			if nums[i] % 2 == 0:
				has = False
				break
	if has:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 1
	for i in range(1, n):
		if a[i] % 2 != a[i - 1] % 2:
			ans = 0
	if ans == 1:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	flag = 0
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			if abs(a[i] - a[j]) % 2 != 0:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	n = ii()
	a = li()
	for i in range(n):
		a[i] %= 2
	if sum(a) == 0 or sum(a) == n:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = int(input())
	y = input().split()
	counter = 0
	for j in range(1, x):
		if int(y[j]) % 2 != int(y[0]) % 2:
			counter += 1
	if counter != 0:
		print('NO')
	else:
		print('YES')


no = int(input())
ans = []
for _ in range(no):
	x = int(input())
	a = list(map(int, input().split()))
	flag = True
	for i in range(x - 1):
		if abs(a[i] - a[i + 1]) % 2 != 0:
			ans.append('NO')
			flag = False
			break
	if flag:
		ans.append('YES')
for i in ans:
	print(i)


for _ in range(int(input())):
	c = int(input())
	l = list(map(int, input().split()))
	m = max(l) - 1
	f = True
	if len(set(l)) == 1:
		print('YES')
		continue
	else:
		for i in range(c):
			try:
				if (l[i] - l[i + 1]) % 2 == 0:
					continue
				else:
					print('NO')
					f = False
					break
			except:
				break
	if f:
		print('YES')


for _ in '0' * int(input()):
	input()
	ls = list(map(int, input().split()))
	max_ls = max(ls)
	f = list(filter(lambda x: (max_ls - x) % 2 != 0, ls))
	print('YNEOS'[f != []::2])


t = int(input())
for _ in range(t):
	even = 0
	odd = 0
	ans = 0
	n = int(input())
	a = input().split()
	for i in range(len(a)):
		a[i] = int(a[i])
	for i in range(len(a)):
		if a[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd > 0 and even > 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	N = list(map(int, input().split(' ')))
	maxi = max(N)
	mini = min(N)
	count = 0
	for i in range(n):
		if (maxi - N[i]) % 2 != 0:
			count = count + 1
	if maxi == mini:
		print('YES')
	elif count > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	ok = 0
	while i < len(a):
		j = i + 1
		while j < len(a):
			if abs(a[i] - a[j]) % 2 != 0:
				ok = 1
			j += 1
		i += 1
	if ok == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if arr[0] % 2 == 0:
		cnt = 0
		for i in range(n):
			if arr[i] % 2 == 0:
				cnt += 1
		if cnt == n:
			print('YES')
		else:
			print('NO')
	else:
		cnt = 0
		for i in range(n):
			if arr[i] % 2 != 0:
				cnt += 1
		if cnt == n:
			print('YES')
		else:
			print('NO')


n = int(input())
l = []
for i in range(n):
	y = int(input())
	u = list(map(int, input().split()))
	l += [u]
v = 0
r = True
for i in l:
	v = max(i)
	for j in i:
		c = v - j
		if c % 2 == 0:
			r = True
		else:
			r = False
			break
	if r:
		print('YES')
	else:
		print('NO')
	r = True


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	amin = min(arr)
	for i in range(len(arr)):
		arr[i] -= amin
	ans = True
	for i in range(len(arr) - 1):
		if arr[i] % 2 != arr[i + 1] % 2:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


def tetris(array):
	num = array[0] % 2
	for a in array:
		if a % 2 != num:
			return False
	return True
testCases = int(input())
for t in range(testCases):
	n = int(input())
	array = list(map(int, input().split()))
	if tetris(array):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	size = int(input())
	blocks = list(map(int, input().split()))
	flag = 1
	for b in range(1, size):
		diff = abs(blocks[b - 1] - blocks[b])
		if diff % 2:
			flag -= 1
			break
	print('YES' if flag else 'NO')


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	f1 = False
	f2 = False
	for elem in a:
		if elem % 2 == 0:
			f1 = True
		else:
			f2 = True
	if f1 == f2:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	o = 0
	e = 0
	for i in l:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	if e == 0 or o == 0:
		print('YES')
	else:
		print('NO')


def check(list1, val):
	return all((abs(int(x) - int(val)) % 2 == 0 for x in list1))
for t in range(int(input())):
	flag = 0
	i = int(input())
	a = input().split()
	for k in range(i):
		if check(a, a[k]):
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
s = []
for jfb in range(0, t):
	n = int(input())
	x = input()
	xx = x.split()
	if n > 1:
		for i in range(0, n):
			xx[i] = int(xx[i])
		h = 0
		for i in range(0, n - 1):
			k = xx[i + 1] - xx[i]
			if k % 2 == 1:
				s.append('NO')
				h += 1
				break
		if h == 0:
			s.append('YES')
	else:
		s.append('YES')
for i in s:
	print(i)


for i in range(int(input())):
	n = int(input())
	v = [int(i) for i in input().split()]
	for i in range(1, n):
		if v[i - 1] % 2 != v[i] % 2:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	mi = min(arr)
	status = 0
	for i in range(n):
		if (arr[i] - mi) % 2 != 0:
			status = 0
			break
		else:
			status = 1
	if status == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	li = list(map(int, input().split()))
	m = max(li)
	flag = True
	for a in li:
		if (m - a) % 2 != 0:
			print('NO')
			flag = False
			break
	if not flag:
		t -= 1
		continue
	print('Yes')
	t -= 1


t = int(input())
for i in range(t):
	p = int(input())
	a = input().split()
	even = 0
	odd = 0
	for i in range(p):
		if int(a[i]) % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == p or odd == p:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	e = 0
	o = 0
	z = 0
	for item in l:
		if item % 2 == 0:
			e += 1
		elif item % 2 != 0:
			o = 0 + 1
		if e != 0 and o != 0:
			print('NO')
			z = 1
			break
	if z != 1:
		print('YES')


from sys import stdin, stdout
x = [line.rstrip() for line in stdin]
del x[0]
for i in x[1::2]:
	d = list(map(int, i.split()))
	a = True
	o = d[0] % 2
	for k in d:
		if k % 2 != o:
			a = False
			break
	if a:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	for test in range(tests):
		col = inp()
		tet = inlt()
		is_odd = tet[0] % 2
		flag = 0
		for i in tet:
			if i % 2 != is_odd:
				flag = 1
				break
		if flag == 0:
			print('Yes')
		else:
			print('No')
	return 0
main()


def tetris():
	cases = int(input())
	for case in range(cases):
		columns_num = input()
		columns = list(map(int, input().split()))
		highest = max(columns)
		found = False
		for column in columns:
			if (highest - column) % 2 == 1:
				found = True
				break
		if found:
			print('NO')
		else:
			print('YES')
tetris()


res = ''
for _ in range(int(input())):
	n = int(input())
	heights = tuple(map(int, input().split()))
	status = 'YES\n'
	for (i, v) in enumerate(heights):
		if i == 0:
			continue
		elif abs(v - heights[i - 1]) % 2 != 0:
			status = 'NO\n'
			break
	res += status
print(res)


t = int(input())
for x in range(t):
	N = int(input())
	sum1 = 0
	sum2 = 0
	m = list(map(int, input().split()))
	for i in m:
		if i % 2 == 0:
			sum1 += 1
		else:
			sum2 += 1
	if sum1 == 0 or sum2 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	(odd, even) = (0, 0)
	for j in l:
		if j % 2:
			odd += 1
		else:
			even += 1
	if odd > 0 and even > 0:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	a = int(input())
	mylist = list(map(int, input().strip().split()))
	even = 0
	odd = 0
	for k in mylist:
		if k % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == 0 or odd == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	k = int(input())
	a = list(map(int, input().split()))
	c = 0
	for i in a:
		if i % 2 != 0:
			c += 1
	if c == len(a):
		print('YES')
	elif c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	o = set()
	for j in a:
		o.add(j % 2)
	if len(o) == 2:
		print('NO')
	else:
		print('YES')


def possible(l, n):
	for i in range(1, n):
		if (l[i] - l[i - 1]) % 2 != 0:
			return 'No'
	return 'Yes'
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(possible(l, n))


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	ans = 1
	for i in range(n - 1):
		if (s[i] - s[i + 1]) % 2 == 1:
			ans = -1
			break
	if ans == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	r = int(input())
	a = list(map(int, input().split()))
	d = max(a)
	ok = True
	for j in range(r):
		if (max(a) - a[j]) % 2 != 0:
			ok = False
	print('YES' if ok else 'NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list((int(i) for i in input().split(' ')))
	fm = a[0] % 2
	for i in a:
		if i % 2 != fm:
			print('NO')
			break
	else:
		print('YES')


def read():
	n = input()
	return int(n)
t = read()
while t != 0:
	n = read()
	nums = input().split()
	rest = -1
	ok = 1
	for i in nums:
		x = int(i)
		if rest == -1:
			rest = x % 2
		if x % 2 != rest:
			ok = 0
			break
	if ok == 1:
		print('YES\n')
	else:
		print('NO\n')
	t -= 1


from math import *
from sys import *
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	x = a[0] % 2
	f = 0
	for i in range(n):
		if a[i] % 2 != x:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


I = input
exec(int(I()) * "I();print('YNEOS'[len({x%2for x in map(int,I().split())})>1::2]);")


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	n = inn()
	a = arr()
	d = defaultdict(int)
	for i in a:
		d[i % 2] += 1
	if len(d) == 1:
		print('YES')
	else:
		print('NO')


qq = int(input())
for _ in range(qq):
	n = int(input())
	dat = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	c = dat[0] % 2
	f = True
	for i in range(n):
		if c != dat[i] % 2:
			f = False
	print('YES' if f else 'NO')


def teste(arry, size):
	dist = 0
	flag = True
	for a in range(size):
		for b in range(size):
			k = arry[a] - arry[b]
			if k < 0:
				k = k * -1
			dist = k
			if dist == 0 or dist % 2 == 0:
				flag = True
			else:
				flag = False
				return flag
	if flag == True:
		return flag
x = int(input())
for i in range(x):
	size = int(input())
	arry = list(map(int, input().split(' ')))
	if teste(arry, size) == True:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(0, a):
	b = int(input())
	arr = list(map(int, input().split()))
	count = 0
	for i in range(0, len(arr)):
		if count == 0:
			for j in range(i, len(arr)):
				if (arr[i] - arr[j]) % 2 != 0:
					count = 1
					break
		else:
			break
	if count == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	input()
	a = map(int, input().split())
	first = next(a) & 1
	for x in a:
		if x & 1 != first:
			print('NO')
			break
	else:
		print('YES')


def solve():
	n = int(input())
	A = list(map(int, input().split()))
	for i in range(n - 1):
		if A[i] % 2 != A[i + 1] % 2:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for i in range(t):
	solve()


def teris(arr, n):
	min_n = min(arr)
	res = [(i - min_n) % 2 for i in arr]
	return ['NO', 'YES'][sum(res) == 0]
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	arr = [int(s) for s in input().split(' ')]
	h = teris(arr, n)
	print(h)


for i in range(int(input())):
	temp1 = int(input())
	litest = list(map(int, input().split()))
	switch = 0
	litest.sort()
	temp2 = litest[0]
	for j in range(temp1):
		litest[j] -= temp2
	for k in range(temp1):
		if litest[k] % 2 == 1:
			print('NO')
			switch = 1
			break
	if switch == 0:
		print('YES')


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	p = il()
	a = []
	for i in range(1, n):
		if abs(p[i] - p[i - 1]) % 2 == 0:
			a.append(0)
		else:
			a.append(1)
	if sum(a) == 0:
		print('YES')
	else:
		print('NO')


def main():
	t = 1
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		b = len(list(filter(lambda x: x % 2 == 1, a)))
		if min(b, n - b) == 0:
			print('YES')
		else:
			print('NO')
	return
main()


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, A):
	ma = min(A)
	for a in A:
		if (a - ma) % 2 != 0:
			return 'No'
	return 'Yes'

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		A = read_int_n()
		print(slv(N, A))
main()


test = int(input())
for i in range(0, test):
	num_cols = int(input())
	l = list(map(int, input().split()))
	odd_check = False
	even_check = False
	flag = True
	for i in l:
		if i % 2 == 0:
			even_check = True
		else:
			odd_check = True
		if odd_check and even_check:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


n = int(input())
for k in range(n):
	j = int(input())
	z = input().split(' ')
	z = [int(i) for i in z]
	m = max(z)
	flag = 1
	for i in z:
		if (m - i) % 2 != 0:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	if sum(map(lambda x: x % 2, map(int, input().split()))) in (0, n):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	w = int(input())
	kk = list(map(int, input().split()))
	sq = 0
	sp = set()
	for j in range(w):
		sp.add(kk[j] % 2)
	if len(sp) == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
n = int(stdin.readline())
a = []
for i in range(n):
	l = int(stdin.readline())
	a.append([int(x) for x in stdin.readline().split()])
for k in range(n):
	counter = 0
	for j in range(len(a[k])):
		if (max(a[k]) - a[k][j]) % 2 == 0:
			counter += 1
	if counter == len(a[k]):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	if a[0] % 2 == 0:
		f = False
	else:
		f = True
	xx = False
	for i in range(1, n):
		if a[i] % 2 == 0 and f or (a[i] % 2 == 1 and (not f)):
			xx = True
			print('NO')
			break
	if not xx:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	even = False
	odd = False
	for i in l:
		if i % 2 == 0:
			even = True
		else:
			odd = True
	if odd and even:
		print('NO')
	else:
		print('YES')


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	t = sint()
	while t:
		t -= 1
		n = sint()
		ara = sara()
		flg = 1
		for i in range(n - 1):
			if ara[i] % 2 != ara[i + 1] % 2:
				flg = 0
				break
		if flg:
			print('Yes')
		else:
			print('No')
main()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict

def solution(n, arr):
	(f1, f2) = (0, 0)
	for i in range(n):
		if arr[i] & 1:
			f1 = 1
		else:
			f2 = 1
	if f1 and f2:
		print('NO')
	else:
		print('YES')

def main():
	for _ in range(r_int()):
		n = r_int()
		arr = r_array()
		solution(n, arr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def p_array(arr):
	for x in arr:
		print(x, end=' ')
	print()
main()


def solve():
	n = int(input())
	l = list(map(int, input().split()))
	s = set()
	for i in l:
		s.add(i % 2)
	if len(s) == 1:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


import math
n = int(input())
for t in range(n):
	b = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(b - 1):
		if abs(a[i] - a[i + 1]) % 2 != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = input()
	a = input()
	l = [int(i) for i in a.split()]
	impar = False
	par = False
	for i in l:
		if i % 2 == 0:
			par = True
		else:
			impar = True
	if impar and par:
		print('NO')
	else:
		print('YES')


n = int(input())
for j in range(n):
	m = int(input())
	a = list(map(int, input().split()[:m]))
	maximum = 1
	i = 0
	while i < len(a):
		while a[i] < maximum:
			a[i] += 2
		if a[i] % maximum == 1 and a[i] - maximum == 1:
			print('NO')
			break
		if a[i] > maximum:
			maximum = a[i]
			i = 0
		else:
			i += 1
	else:
		print('YES')


tests = int(input())
for _ in range(tests):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = min(a)
	a = [x - m for x in a]
	res = 'YES'
	for v in a:
		if v % 2 != 0:
			res = 'NO'
			break
	print(res)


n = int(input())
for _ in range(n):
	x = int(input())
	s = input().split()
	for i in range(x):
		s[i] = int(s[i])
	M = s[0] % 2
	for i in range(1, x):
		if s[i] % 2 != M:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	mx = max(arr)
	flag = True
	for a in arr:
		if (mx - a) % 2 != 0:
			flag = False
			break
	res = 'YES' if flag else 'NO'
	print(res)


t = int(input())
for num in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	res = -1
	for i in a:
		if res == -1:
			res = i % 2
		elif res != i % 2:
			print('NO')
			res = 3
			break
	if res != 3:
		print('YES')


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, stdin.readline().rstrip().split(' ')))
	c_o = c_e = 0
	for i in arr:
		if i % 2:
			c_o += 1
		else:
			c_e += 1
	if c_o and c_e:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	flag = True
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) % 2 != 0:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


Q = int(input())
for _ in range(Q):
	N = int(input())
	A = [int(i) for i in input().split()]
	f = False
	minh = 10 ** 5
	for i in A:
		minh = min(minh, i)
	for i in range(N):
		A[i] -= minh
		if A[i] % 2 != 0:
			print('NO')
			f = True
			break
	if not f:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [ai % 2 for ai in a]
	if b == [b[0]] * n:
		print('YES')
	else:
		print('NO')


times = int(input())
for j in range(times):
	largura = int(input())
	matriz = []
	menor = 200
	x = input().split()
	for i in range(len(x)):
		var = int(x[i])
		matriz.append(var)
		if var < menor:
			menor = var
	for i in range(len(matriz)):
		matriz[i] -= menor
	flag = False
	for i in range(len(matriz)):
		if matriz[i] % 2 != 0:
			flag = True
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	min1 = min(a)
	for i in range(0, len(a)):
		a[i] -= min1
	for i in range(0, len(a)):
		if a[i] == 0 or a[i] % 2 == 0:
			continue
		else:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split(' ')]
	m = max(l)
	f = 0
	for i in l:
		if (m - i) % 2 != 0:
			f = 1
			break
	res = 'YES' if f == 0 else 'NO'
	print(res)


for i in range(int(input())):
	n = int(input())
	a = [int(s) for s in input().split()]
	even = 0
	odd = 0
	for i in a:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	print('YES' if abs(even - odd) == n else 'NO')


def solvee():
	amount = int(input())
	for i in range(amount):
		length = int(input())
		figure = list(map(int, input().split()))
		even = 0
		odd = 0
		for item in figure:
			if item % 2 == 0:
				even += 1
			else:
				odd += 1
			if even > 0 and odd > 0:
				print('NO')
				break
		if odd == 0 or even == 0:
			print('YES')
solvee()


for i in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	maxi = max(list1)
	c = 0
	for i in range(n):
		if list1[i] % 2 != maxi % 2:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	s = int(input())
	z = list(map(int, input().split()))
	ans = []
	flag = 0
	for i in range(1, len(z)):
		ans.append(z[i] - z[i - 1])
		if ans[-1] % 2 == 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	par = 0
	impar = 0
	n = int(input())
	s = str(input()).split()
	for j in range(len(s)):
		s[j] = int(s[j])
		if s[j] % 2 == 0:
			par += 1
		else:
			impar += 1
		if impar > 0 and par > 0:
			print('NO')
			break
	if par == 0 or impar == 0:
		print('YES')


import sys
for i in range(int(sys.stdin.readline())):
	s = int(sys.stdin.readline())
	ls = [int(a) for a in sys.stdin.readline().split()]
	par = 1
	if ls[0] % 2 == 0:
		par = 0
	f = True
	for i in ls:
		if i % 2 != par:
			f = False
			break
	if f:
		print('YES')
		continue
	print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	f = 0
	for i in range(n):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) & 1:
				f = 1
	if f:
		print('NO')
	else:
		print('YES')


n = int(input())
for x in range(n):
	dim = int(input())
	size = list(map(int, input().split()))
	y = min(size)
	size = [x - y for x in size]
	i = 1
	if size == [0] * dim:
		i = 1
	else:
		for a in size:
			if a % 2 != 0:
				i = 0
				break
	if i == 0:
		print('NO')
	else:
		print('YES')


q = int(input())
while q:
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0, 0]
	for i in a:
		cnt[i % 2] += 1
	if not (cnt[0] == n or cnt[0] == 0):
		print('NO')
	else:
		print('YES')
	q -= 1


t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	l = max(a)
	flag = 0
	for i in a:
		if (l - i) % 2 != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	l = inp()
	q = inlt()
	check = False
	for j in range(500):
		m = max(q)
		for k in range(l):
			while q[k] < m:
				q[k] = q[k] + 2
		while not 0 in q:
			q = [i - min(q) for i in q]
		if sum(q) == 0:
			check = True
			break
	if check:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	v = 0
	for i in range(1, n):
		if (l[i] - l[i - 1]) % 2 != 0:
			print('NO')
			v = 1
			break
	if v == 0:
		print('YES')


def q():
	b = eval(input())
	c = list(map(int, input().strip().split()))
	c.sort(reverse=True)
	for i in range(0, len(c) - 1):
		c[i] = c[i] - c[i + 1]
	for i in range(len(c) - 1):
		if c[i] & 1 != 0:
			print('NO')
			return 0
	print('YES')
	return 0
a = eval(input())
for i in range(a):
	q()


t = int(input())
for i in range(t):
	col = int(input())
	even = odd = 0
	ele = input()
	arr = ele.split()
	for i in range(0, len(arr)):
		arr[i] = int(arr[i])
	for q in range(col):
		if arr[q] % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd == col or even == col:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	t2 = [int(x) for x in input().split()]
	even = False
	if t2[0] % 2 == 0:
		even = True
	if even == True:
		for elem in t2[1:]:
			if elem % 2 != 0:
				print('NO')
				break
		else:
			print('YES')
	else:
		for elem in t2[1:]:
			if elem % 2 == 0:
				print('NO')
				break
		else:
			print('YES')


n = int(input())
x = []
y = ''
for i in range(n):
	a = int(input())
	b = list(set(map(int, input().split())))
	for j in range(len(b)):
		c = b[j] - min(b)
		if c % 2 != 0:
			y = 'NO'
			break
		else:
			y = 'YES'
	x.append(y)
print('\n'.join(x))


def checker(lst):
	if all((elem % 2 == 0 for elem in lst)) or all((elem % 2 != 0 for elem in lst)):
		return True
	return False
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	print('YES' if checker(a) else 'NO')


for i in range(int(input())):
	col = int(input())
	heights = list(map(int, input().split()))
	out = False
	for j in range(1, col):
		if (heights[j] - heights[j - 1]) % 2 != 0:
			print('NO')
			out = True
			break
	if out:
		continue
	else:
		print('YES')


from collections import Counter
t = int(input())
for _ in range(t):
	(n, a) = (int(input()), (int(i) for i in input().split()))
	res = 'YES' if len(Counter((i & 1 for i in a))) == 1 else 'NO'
	print(res)


t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	t = b[0] % 2
	lol = 0
	for j in range(a):
		if t != b[j] % 2:
			lol = 1
			break
	if lol == 0:
		print('YES')
	else:
		print('NO')


c = int(input())
for _ in range(0, c):
	inp = int(input())
	i = list(map(int, input().split()))
	tek = 0
	cift = 0
	for k in i:
		if k % 2 == 1:
			tek = tek + 1
		else:
			cift = cift + 1
		if tek != 0 and cift != 0:
			print('NO')
			break
	if tek == 0 or cift == 0:
		print('YES')


def solve():
	n = int(input())
	array = list(set(map(int, input().split())))
	if len(array) == 1:
		print('YES')
		return
	array = [array[i] - array[i - 1] for i in range(1, len(array))]
	for a in array:
		if a % 2 == 1:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	n = int(input())
	h = sum(map(lambda i: int(i) % 2, input().split()))
	if h == 0 or h == n:
		print('YES')
	else:
		print('NO')


t = int(input())
for iii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n - 1):
		if a[i] % 2 != a[i + 1] % 2:
			print('NO')
			break
	if n == 1 or a[i] % 2 == a[i + 1] % 2:
		print('YES')


from sys import stdin, stdout
import math
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		a[i] = a[i] % 2
	if a.count(1) == n or a.count(1) == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	N = int(input())
	A = list(map(int, input().split()))
	X = min(A)
	ans = True
	for i in range(N):
		A[i] -= X
		if A[i] & 1:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
while T:
	T -= 1
	N = int(input())
	if N == 1:
		input()
		print('YES')
	else:
		nl = list(map(int, input().split()))
		chk = 0
		if nl[0] & 1:
			for i in nl:
				if not i & 1:
					print('NO')
					chk = 1
					break
		else:
			for i in nl:
				if i & 1:
					print('NO')
					chk = 1
					break
		if not chk:
			print('YES')


t = int(input())
for test in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = max(a)
	res = []
	flag = 1
	for i in a:
		if (m - i) % 2 != 0:
			flag = 0
			break
	print('YES' if flag else 'NO')


def solve(n, A):
	return len({a % 2 for a in A}) == 1
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	print('YES' if solve(n, A) else 'NO')


for i in range(int(input())):
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = int(a[i])
	m = min(a)
	for i in range(n):
		a[i] -= m
	ans = 'YES'
	for i in range(n):
		if a[i] % 2 != 0:
			ans = 'NO'
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = [a % 2 for a in A]
	if max(B) == min(B):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	v = list(map(int, input().split()))
	evens = 0
	odds = 0
	for e in v:
		if e % 2 == 0:
			evens += 1
		else:
			odds += 1
	if evens == 0 or odds == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if all((i % 2 == 0 for i in l)) or all((i % 2 == 1 for i in l)):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	print('NO' if any([x - m & 1 for x in a]) else 'YES')


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	n = iinput()
	a = rlinput()
	mx = max(a)
	flag = False
	for i in a:
		if abs(mx - i) % 2:
			flag = True
			break
	print('YES' if not flag else 'NO')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	all_odd = all((v & 1 for v in a))
	all_even = all((v & 1 == 0 for v in a))
	if all_even or all_odd:
		print('YES')
	else:
		print('NO')


t = int(input())
for sai in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	x = min(a)
	for i in range(n):
		a[i] = a[i] - x
	for i in range(n):
		if a[i] % 2 == 0:
			a[i] = 0
	if a == [0] * n:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(int, input().strip().split()))
		arr.sort()
		flag = False
		for i in range(n):
			if (arr[-1] - arr[i]) % 2 != 0:
				flag = True
				break
		if flag:
			print('NO')
		else:
			print('YES')
main()


import sys

def solve(n, numbers):
	odd = 0
	even = 0
	for i in range(n):
		temp = numbers[i]
		if temp % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd > 0 and even > 0:
		print('NO')
	else:
		print('YES')
t = int(input())
testcase = 1
while testcase <= t:
	n = int(input())
	numbers = list(map(int, input().split(' ')))
	solve(n, numbers)
	testcase += 1


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	m = min(a)
	ok = True
	for i in a:
		ok = ok and (i - m) % 2 == 0
	print('YES' if ok else 'NO')


t = int(input())
inputs = [list(map(int, input().split())) for _ in range(t * 2)]
i = 1
for _ in range(t):
	if len(inputs[i]) < 2:
		print('YES')
	else:
		if min(inputs[i]) > 0:
			tetris = min(inputs[i])
			for j in range(0, inputs[i - 1][0]):
				inputs[i][j] -= tetris
				if inputs[i][j] % 2 == 0:
					inputs[i][j] = True
				else:
					inputs[i][j] = False
					if inputs[i][j - 1] and inputs[i][j - 1] == inputs[i][j]:
						(inputs[i][j - 1], inputs[i][j]) = (True, True)
		if False in inputs[i]:
			print('NO')
		else:
			print('YES')
	i += 2


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase
from bisect import bisect_left as bl
from bisect import bisect_right as br

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def modpow(b, p, m):
	res = 1
	b = b % m
	while p:
		if p & 1:
			res = res * b % m
		b = b * b % m
		p >>= 1
	return res

def mod_inv(a, m):
	return modpow(a, m - 2, m)

def ncr(n, r, m):
	res = 1
	if r == 0:
		return 1
	if n - r < r:
		r = n - r
	(p, k) = (1, 1)
	while r:
		res = res % m * (n % m * mod_inv(r, m) % m) % m
		n -= 1
		r -= 1
	return res

def ncrlis(n, r, m, fact):
	return fact[n] * (mod_inv(fact[r], m) * mod_inv(fact[n - r], m)) % m % m

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(ii()):
	n = ii()
	a = li()
	(fo, fe) = (1, 1)
	for i in range(n):
		if a[i] & 1:
			fo &= 1
			fe &= 0
		else:
			fe &= 1
			fo &= 0
	if fo or fe:
		print('YES')
	else:
		print('NO')


for x1 in range(int(input())):
	n = int(input())
	m = list(map(int, input().strip().split()[:n]))
	k = min(m)
	even = 0
	odd = 0
	for x in range(n):
		m[x] = m[x] - k
		if m[x] % 2 == 0:
			even += 1
		else:
			odd += 1
	if even == 0 or odd == 0:
		print('YES')
	else:
		print('NO')


def sol(a):
	for i in range(1, len(a)):
		if (a[i] - a[i - 1]) % 2 != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	print(sol(arr))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	result = 'YES'
	for i in range(n):
		if a[i] % 2 != a[0] % 2:
			result = 'NO'
	print(result)


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	(c, d) = (0, 0)
	for i in b:
		if i % 2 == 0:
			c += 1
		else:
			d += 1
	if min(c, d) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for rep in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ce = 0
	co = 0
	for i in range(n):
		if a[i] % 2 == 0:
			ce += 1
		else:
			co += 1
	if ce == 0 or co == 0:
		print('YES')
	else:
		print('NO')


for TC in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	m = max(arr)
	flag = True
	for i in arr:
		if i < m and (m - i) % 2 != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	ans = 0
	if n == 1:
		print('YES')
	else:
		for j in range(len(x) - 1):
			if abs(x[j] - x[j + 1]) % 2 != 0:
				ans = 1
		print('NO' if ans == 1 else 'YES')


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	n = I()
	a = L()
	cnt = sum([(a[i] - a[0]) % 2 != 0 for i in range(n)])
	print(['YES', 'NO'][cnt > 0])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	isthat = all((x % 2 == 0 for x in l)) or all((x % 2 == 1 for x in l))
	if isthat:
		print('YES')
	else:
		print('NO')


def f(a):
	if len(a) == 1:
		print('YES')
		return
	fst = max(a)
	if fst % 2 == 0:
		for i in range(len(a)):
			if a[i] % 2 != 0:
				print('NO')
				return
	else:
		for i in range(len(a)):
			if a[i] % 2 == 0:
				print('NO')
				return
	print('YES')
	return

def main():
	t = int(input())
	while t:
		t -= 1
		_ = int(input())
		a = list(map(int, input().split()))
		f(a)
main()


test_case = int(input())
for ___ in range(test_case):
	n = int(input())
	l = [int(x) for x in input().split()]
	c = 0
	for i in range(n - 1):
		if (l[i] - l[i + 1]) % 2 == 0:
			c += 1
	if c == n - 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = len(a)
	(count_odd, count_even) = (0, 0)
	ans = 'YES'
	if n == 1:
		pass
	else:
		for i in a:
			if i & 1:
				count_odd += 1
			else:
				count_even += 1
		if abs(count_even - count_odd) != k:
			ans = 'NO'
	print(ans)


lst = []
while True:
	try:
		lst.append(input().split())
	except:
		break
for i in range(2, len(lst), 2):
	lst1 = list(map(int, lst[i]))
	while True:
		if sum(lst1) == 0:
			print('YES')
			break
		lst1 = sorted(lst1)
		if lst1[0] == 0:
			if 1 in lst1:
				print('NO')
				break
			else:
				lst1[0] += 2
		else:
			a = lst1[0]
			for j in range(0, len(lst1)):
				lst1[j] -= a


import sys

def main():
	for _ in range(int(sys.stdin.readline())):
		n = int(sys.stdin.readline())
		l = [int(y) for y in sys.stdin.readline().split()]
		odd = 0
		even = 0
		for i in l:
			if i % 2 == 0:
				even += 1
			else:
				odd += 1
		if odd == n or even == n:
			print('YES')
		else:
			print('NO')
main()


for qq in range(int(input())):
	n = int(input())
	a = list(map(lambda x: int(x) % 2, input().split()))
	print('YNEOS'[len(set(a)) == 2::2])


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	k = ar[0] % 2
	flg = 0
	for i in range(1, n):
		if ar[i] % 2 != k:
			flg = 1
			break
	if flg == 1:
		print('NO')
	else:
		print('YES')


count = int(input())
while count > 0:
	n = int(input())
	a = list(map(int, input().split()))
	x = []
	list.sort(a)
	for i in range(n):
		if (a[-1] - a[i]) % 2 == 0:
			x.append(1)
		else:
			x.append(0)
	tell = 0
	for i in range(n):
		if x[i] == 0:
			tell = tell + 1
	if tell > 0:
		print('NO')
	else:
		print('YES')
	count = count - 1


p = int(input())
while p:
	(n, x) = (int(input()), 0)
	a = list(map(int, input().split()))
	m = min(a)
	for i in range(n):
		a[i] -= m
	for i in range(n):
		if a[i] % 2:
			x = 1
			break
	if x:
		print('NO')
	else:
		print('YES')
	p -= 1


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	ch = min(s)
	ans = 'YES'
	for j in s:
		if (j - ch) % 2 != 0:
			ans = 'NO'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [1 for i in range(n) if a[i] % 2 == 0]
	if len(b) == n or len(b) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	c = int(input())
	li = [int(x) for x in input().split()]
	li = [x % 2 for x in li]
	if sum(li) == 0 or sum(li) == c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	e = 0
	o = 0
	for t in l:
		if t % 2:
			o += 1
		else:
			e += 1
	if not e or not o:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	input()
	print('YES' if {a % 2 for a in map(int, input().split())} < {0, 1} else 'NO')


for i in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	r = 0
	for i in range(am):
		if arr[i] % 2 == 1:
			r += 1
	if r == am or r == 0:
		print('YES')
	else:
		print('NO')


def foo(ar):
	m = min(ar)
	for el in ar:
		if (el - m) % 2 == 1:
			return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	if foo(a):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	d = list(map(int, input().split()))
	s = sum([i % 2 for i in d])
	if s == 0 or s == n:
		print('YES')
	else:
		print('NO')


T = int(input())
tf = False
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	if l[0] % 2 == 0:
		for j in range(n):
			if l[j] % 2 != 0:
				print('NO')
				tf = True
				break
		if tf == False:
			print('YES')
	else:
		for j in range(n):
			if l[j] % 2 != 1:
				print('NO')
				tf = True
				break
		if tf == False:
			print('YES')
	tf = False
quit()


def solve():
	for i in range(n):
		for j in range(i, n):
			if abs(a[i] - a[j]) % 2 == 1:
				return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = False
	m = min(a)
	for i in range(n):
		a[i] -= m
	if solve():
		print('YES')
	else:
		print('NO')


q = int(input())
for q in range(q):
	n = int(input())
	ch = False
	nech = False
	arr = list(map(int, input().split(' ')))
	for x in arr:
		if x % 2 == 0:
			ch = True
		else:
			nech = True
	if ch and nech:
		print('NO')
	else:
		print('YES')


a = int(input())
for _ in range(a):
	z = 0
	main1 = int(input())
	main2 = input()
	main2m = main2.split()
	main2m.sort(key=int, reverse=False)
	for i in range(main1 - 1):
		if (int(main2m[main1 - 1]) - int(main2m[i])) % 2 != 0:
			print('NO')
			z = 1
			break
	if z == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	ok = 1
	a = [int(x) for x in input().split()]
	for i in range(n - 1):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) % 2 != 0:
				ok = -1
				break
		if ok == -1:
			break
	if ok == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
columns_number = []
columns_height = []
answers = []
for i in range(t):
	columns_number.append(int(input()))
	columns_height.append([int(x) for x in input().split()])
for packet in columns_height:
	packet.sort()
for i in range(len(columns_number)):
	answers.append('YES')
	substitute = columns_height[i][0]
	for j in range(len(columns_height[i])):
		columns_height[i][j] -= substitute
		if columns_height[i][j] % 2 != 0:
			answers[i] = 'NO'
			break
for ans in answers:
	print(ans)


def clearLine(L, n):
	for i in range(n):
		L[i] -= 1
	return L

def checkLine(L, n):
	for i in range(n):
		if L[i] % 2 == 1:
			return False
	return True
for t in range(int(input())):
	n = int(input())
	L = sorted(map(int, input().split()))
	while L[0] >= 1:
		L = clearLine(L, n)
	if checkLine(L, n):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	we = float('inf')
	for e in range(len(l)):
		we = min(we, l[e])
	h = 0
	for w in range(len(l)):
		l[w] = l[w] - we
		if l[w] != 0:
			h = 1
	if h == 0:
		print('YES')
	else:
		h = 0
		for e in range(len(l)):
			if l[e] % 2 == 1:
				h = 1
		if h == 0:
			print('YES')
		else:
			print('NO')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans.append('YES') if 1 not in list(map(lambda x: (x - min(l)) % 2, l)) else ans.append('NO')
for _ in ans:
	print(_)


class Solution:

	def __init__(self):
		self.__n = int(input())
		self.__a = [int(x) for x in input().split()]

	def solve_and_print(self):
		self.__a.sort()
		print('NO' if any((self.__a[i + 1] - self.__a[i] & 1 for i in range(self.__n - 1))) else 'YES')
for _ in range(int(input())):
	Solution().solve_and_print()


t = int(input())
for ti in range(t):
	n = int(input())
	li = [int(i) for i in input().split(' ')]
	j = li[0]
	f = 0
	for i in li:
		if i - j & 1:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	A = getInts()
	a_set = set()
	for a in A:
		a_set.add(a % 2)
	return 'YES' if len(a_set) < 2 else 'NO'
for _ in range(getInt()):
	print(solve())


def tetris(x):
	s = x[0] % 2
	for i in range(1, len(x)):
		if x[i] % 2 != s:
			return 'NO'
	return 'YES'
cases = int(input())
for _ in range(cases):
	l = int(input())
	x = list(map(int, input().split()))
	print(tetris(x))


from sys import stdin
try:
	for _ in range(int(stdin.readline())):
		n = int(stdin.readline())
		arr = list(map(int, stdin.readline().rstrip().split()))
		(m, flag) = (max(arr), 1)
		l = [abs(ele - m) for ele in arr]
		for ele in l:
			if ele % 2 != 0:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')
except:
	pass


t = int(input())
for i in range(t):
	n = int(input())
	h = list(map(int, input().split()))
	mh = max(h)
	c = 0
	for j in h:
		d = mh - j
		if d % 2 != 0:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


def yat(l):
	l.sort()
	d = 0
	for i in range(len(l)):
		l[i] = l[len(l) - 1] - l[i]
		if l[i] % 2 == 1:
			d = 1
			break
	if d:
		print('NO')
	else:
		print('YES')
n = int(input())
for i in range(n):
	p = int(input())
	t = input()
	l = list(map(int, t.split(' ')))
	yat(l)


t = int(input())
for _ in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	m = min(b)
	res = []
	for a in b:
		res.append((a - m) % 2)
	if sum(res):
		print('NO')
	else:
		print('YES')


import sys

def main():
	n = int(input())
	for _ in range(n):
		input()
		r = list(map(int, input().split()))
		m = max(r)
		flag = True
		for el in r:
			while el < m:
				el += 2
			if el > m:
				flag = False
		print('YES') if flag is True else print('NO')
main()


print('\n'.join([['NO', 'YES'][[0, int(input())].count(sum([int(x) % 2 for x in input().split()]))] for c in range(int(input()))]))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = max(l)
	flag = 0
	for i in l:
		if (k - i) % 2 != 0:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


for run in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	if lst[0] % 2 == 0:
		odd = False
	else:
		odd = True
	for i in range(1, n):
		if odd and lst[i] % 2 != 1:
			odd = 'x'
			print('NO')
			break
		if odd == False and lst[i] % 2 != 0:
			odd = 'x'
			print('NO')
			break
	if odd != 'x':
		print('YES')


import sys
IN = sys.stdin.readline
for i in range(int(IN())):
	n = int(IN())
	a = map(int, IN().split())
	print('YES' if len(set([i % 2 for i in a])) == 1 else 'NO')


t = int(input())
for _ in range(t):
	trig = 1
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	a.sort()
	for i in range(n):
		if (a[len(a) - 1] - a[i]) % 2 != 0:
			trig = 0
	if trig:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	flag = 1
	a = list(map(int, input().split()))
	maxm = max(a)
	for i in range(n):
		diff = maxm - a[i]
		if diff % 2 != 0:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())

def q(l, n):
	if n == 1:
		return 'YES'
	else:
		for i in range(n - 1):
			if l[i] % 2 != l[i + 1] % 2:
				return 'NO'
		return 'YES'
for i in range(t):
	n = int(input())
	i = input().split()
	l = list(map(int, i))
	print(q(l, n))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	p = a[0] % 2
	flag = True
	for j in range(n):
		if p != a[j] % 2:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = min(a)
	b = [x - m for x in a]
	for i in b:
		if i % 2:
			print('NO')
			break
	else:
		print('YES')


import math
t = int(input())
for i in range(t):
	n = int(input())
	z = list(map(int, input().split()))
	z = sorted(z)
	l = []
	p = min(z)
	l = [p] * n
	for i in range(n):
		l[i] = z[i] - l[i]
	k = 0
	for i in range(n):
		k = math.gcd(k, l[i])
	if k % 2 == 0:
		print('YES')
	else:
		print('NO')


def count():
	n = int(input())
	a = list(map(int, input().split()))
	x = min(a)
	b = [i - x for i in a]
	for i in range(n):
		if b[i] % 2 != 0:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for i in range(t):
	count()


t = int(input())
for wer in range(t):
	n = int(input())
	f = 0
	a = list(map(int, input().split()))
	for i in range(n):
		for j in range(i + 1, n):
			if (a[j] - a[i]) % 2 != 0:
				f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
q = {}
ans = 0
i = 0
for s in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	if a != 1:
		for i in range(a):
			ans = b[i]
			if (b[0] + ans) % 2 == 1:
				q[s] = 1
				i = a + i
				break
			elif i == a - 1 and (b[0] + ans) % 2 == 0 and ((b[0] + b[i - 1]) % 2 == 0):
				q[s] = 0
			elif (b[0] + ans) % 2 == 0:
				i = i + 1
	else:
		q[s] = 0
	s = s + 1
for s in range(t):
	if q[s] == 0:
		print('YES')
	else:
		print('NO')
	s = s + 1


t = int(input())
for _ in range(t):
	n = int(input())
	lst = input().split()
	lst = [int(i) for i in lst]
	for i in range(1, n):
		if lst[i] % 2 != lst[i - 1] % 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = [int(x) for x in input().strip().split()]
	b = True
	c = True
	for j in range(1, len(a)):
		if (a[j] - a[j - 1]) % 2 == 0:
			b = True
		elif (a[j] - a[j - 1]) % 2 != 0:
			b = False
			break
	if b:
		print('YES')
	elif not b:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = max(a)
	for i in range(n):
		a[i] = b - a[i] & 1
	if max(a) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	cc = int(input())
	a = [int(x) for x in str(input()).split(' ')]
	m = min(a)
	a = map(lambda x: x - m, a)
	b = any((x % 2 != 0 for x in a))
	if b:
		print('NO')
	else:
		print('YES')


def f(output):
	sumeven = 0
	sumodd = 0
	if output[0] % 2 == 0:
		for i0 in output:
			if i0 % 2 == 1:
				sumeven += 1
		if sumeven != 0:
			print('NO')
		else:
			print('YES')
	elif output[0] % 2 == 1:
		for i0 in output:
			if i0 % 2 == 0:
				sumodd += 1
		if sumodd != 0:
			print('NO')
		else:
			print('YES')
n = int(input())
for i in range(n):
	m = int(input())
	output = list(map(int, input().split()))
	f(output)


n = int(input())
while n:
	s = int(input())
	l1 = sum([int(x) % 2 for x in input().split()])
	if l1 == s or l1 == 0:
		print('YES')
	else:
		print('NO')
	n -= 1


import pdb
n = int(input())
case = {}
for i in range(n):
	num_of_block = int(input())
	block = input()
	block = list(map(int, block.split(' ')))
	case[i] = block

def tetris(block):
	p = 0
	leng = len(block)
	for i in range(leng):
		p += block[i] % 2
	if p == 0 or p == leng:
		print('YES')
	else:
		print('NO')
for i in range(n):
	tetris(case[i])


def compute(arr, n):
	stack = []
	for i in arr:
		if i % 2 == 0:
			if not stack:
				stack.append(0)
			elif stack[-1] == 0:
				stack.append(0)
			else:
				return 'NO'
		elif not stack:
			stack.append(1)
		elif stack[-1] == 1:
			stack.append(1)
		else:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(compute(arr, n))


n = int(input())
for i in range(n):
	m = int(input())
	arr = list(map(int, input().strip().split()))
	p = arr[0] % 2
	ans = 'YES'
	for j in range(1, len(arr)):
		mod = arr[j] % 2
		if mod != p:
			ans = 'NO'
			break
	print(ans)


entrada = int(input())
for i in range(entrada):
	x = int(input())
	y = input().split()
	boolean = True
	for e in range(len(y)):
		y[e] = int(y[e])
	for e in range(len(y)):
		if (y[e] - max(y)) % 2 != 0:
			boolean = False
	if boolean:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ss = 0
	for i in a:
		if i % 2:
			ss += 1
		else:
			ss -= 1
	if abs(ss) == n:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	kek = [0, 0]
	for x in arr:
		kek[x % 2] += 1
	print('YES' if kek[0] == 0 or kek[1] == 0 else 'NO')


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = a[0]
	flag = True
	for i in range(1, n):
		if abs(a[i] - s) % 2 == 0 and flag:
			continue
		else:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


T = int(input())
for l in range(T):
	k = 0
	odd = 0
	even = 0
	n = int(input())
	arr_A = list(map(int, input().split()))
	if all((x % 2 == 0 for x in arr_A)):
		print('YES')
	elif all((x % 2 == 1 for x in arr_A)):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	N = int(input())
	arr = [int(x) for x in input().split(' ')]
	m = max(arr)
	b = False
	for x in arr:
		if (m - x) % 2 != 0:
			b = True
			break
	if b:
		print('NO')
	else:
		print('YES')


t = int(input())

def solve():
	n = int(input())
	col = list(map(int, input().split()))
	diffs = []
	for i in range(1, n):
		diffs.append(col[i] - col[i - 1])
	for i in diffs:
		if i % 2 != 0:
			print('NO')
			return
	print('YES')
for i in range(t):
	solve()


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def main():
	for i in range(ii()):
		n = ii()
		a = li()
		o = 0
		e = 0
		a = set(a)
		a = list(a)
		f = 0
		for i in range(len(a)):
			if abs(a[i] - a[i - 1]) % 2 == 0:
				f = 0
			else:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	k = 0
	n = int(input())
	st = list(map(int, input().split()))
	ok = st[0] % 2
	for i in range(1, n):
		if st[i] % 2 != ok:
			print('NO')
			k = 1
			break
	if not k:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	print('YES' if all([(x - min(A)) % 2 == 0 for x in A]) else 'NO')


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	a = sum((i & 1 for i in map(int, input().split())))
	if a == n or not a:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	c = int(input())
	l = list(map(int, input().split()))
	maior = max(l)
	valido = True
	for i in l:
		if (maior - i) % 2 != 0:
			valido = False
	print('YES') if valido == True else print('NO')


def solve():
	n = int(input())
	arr = set(map(int, input().split()))
	if len(arr) == 1:
		return 'YES'
	else:
		mn = min(arr)
		for e in arr:
			if (e - mn) % 2 != 0:
				return 'NO'
	return 'YES'
[print(solve()) for _ in range(int(input()))]


t = int(input())
for z in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	flag = 0
	breakflag = 0
	for i in range(len(l)):
		if i == 0 and l[i] % 2 == 0:
			flag = 0
		elif i == 0 and l[i] % 2 == 1:
			flag = 1
		elif l[i] % 2 == 0 and flag == 1:
			print('NO')
			breakflag = 1
			break
		elif l[i] % 2 == 1 and flag == 0:
			print('NO')
			breakflag = 1
			break
	if breakflag == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	ar = input().split()
	ar = [int(y) for y in ar]
	m = min(ar)
	z = 0
	for i in ar:
		if (i - m) % 2:
			z = 1
			break
	if z:
		print('NO')
	else:
		print('YES')


q = int(input())

def kul(n, arr):
	j = arr[0]
	k = 0
	for i in arr:
		if i % 2 != j % 2:
			k = 1
			print('NO')
			break
	if k == 0:
		print('YES')
for _ in range(q):
	n = int(input())
	arr = list(map(int, input().split()))
	kul(n, arr)


n1 = int(input())
for i in range(n1):
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 1:
		print('YES')
	else:
		t = True
		m = max(a)
		for i in a:
			if (m - i) % 2 != 0:
				print('NO')
				t = False
				break
		if t:
			print('YES')


def a(arr):
	even = False
	odd = False
	for val in arr:
		if val % 2 == 0:
			even = True
		else:
			odd = True
	if even and odd:
		print('NO')
	else:
		print('YES')
tests = int(input())
while tests:
	n = int(input())
	tetris = list(map(int, input().split(' ')))
	a(tetris)
	tests -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 1
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) % 2 != 0:
			c = 0
	if c == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	T = int(rl())
	for _ in range(T):
		n = int(rl())
		A = [int(x) for x in rll()]
		(even, odd) = (0, 0)
		for a in A:
			if a % 2 == 0:
				even += 1
			else:
				odd += 1
		if even > 0 and odd > 0:
			stdout.write('NO')
			stdout.write('\n')
		else:
			stdout.write('YES')
			stdout.write('\n')
	stdout.close()
main()


for _ in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	cnt = sum([i % 2 == 0 for i in ar])
	print(('NO', 'YES')[cnt == 0 or cnt == n])


t = int(input())
for i in range(t):
	n = int(input())
	tetris = list(map(int, input().split(' ')))
	sum0 = 0
	sum1 = 0
	for j in range(len(tetris)):
		if tetris[j] % 2 == 0:
			sum0 += 1
		else:
			sum1 += 1
	if sum0 and sum1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
import bisect

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
for _ in range(ii()):
	n = ii()
	l1 = li()
	l = len(l1)
	if l == 1:
		print('YES')
	else:
		for i in range(1, l):
			if abs(l1[i] - l1[i - 1]) & 1 == 1:
				print('NO')
				break
		else:
			print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(c, v) = (0, 0)
	for i in range(n):
		if a[i] % 2 == 0:
			c += 1
		else:
			v += 1
	if c == n or v == n:
		print('YES')
	else:
		print('NO')


T = int(input())
for test in range(T):
	n = int(input())
	lst = list(map(int, input().split()))
	for i in range(len(lst)):
		lst[i] = lst[i] % 2
	if len(set(lst)) == 1:
		print('YES')
	else:
		print('NO')


testCases = int(input())
for _ in range(testCases):
	n = int(input())
	blocks = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		kind = 0
		if blocks[0] % 2 == 0:
			kind = 1
		else:
			kind = -1
		for index in range(1, n):
			if blocks[index] % 2 == 0 and kind == -1:
				print('NO')
				break
			elif blocks[index] % 2 != 0 and kind == 1:
				print('NO')
				break
			if index == n - 1:
				print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	f = 0
	g = 0
	a = list(map(int, input().split()))
	for i in range(n):
		if a[i] % 2 == 0:
			f = 1
		else:
			g = 1
	if f and g:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	cols = input().split()
	cols = [int(x) for x in cols]
	highest = max(cols)
	can = True
	for a in cols:
		if (highest - a) % 2 != 0:
			can = False
			break
	if can:
		print('YES')
	else:
		print('NO')


import sys, math
sys.setrecursionlimit(10 ** 5 + 10)

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		a = list(map(int, input().split()))
		f = 1
		for k in range(1, n):
			if abs(a[k - 1] - a[k]) % 2 != 0:
				f = 0
				break
		if f == 1:
			print('YES')
		else:
			print('NO')
main()


import sys

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def main():
	for k in range(inp()):
		n = inp()
		col = inlt()
		i = 0
		for b in col:
			if n - 1 != i:
				if (col[i + 1] - b) % 2 == 1:
					print('NO')
					i += 1
					break
			i += 1
			if i == n:
				print('YES')
				break
	return
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = map(int, input().split())
	b = 0
	for __ in a:
		if __ % 2 == 0:
			b += 1
		else:
			b -= 1
	if b == n or b + n == 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for ti in range(int(input().strip())):
	n = int(input().strip())
	a = [int(x) for x in input().strip().split()]
	e = True
	for ai in a:
		if ai % 2:
			e = False
	o = True
	for ai in a:
		if not ai % 2:
			o = False
	if o or e:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	(e, o) = (0, 0)
	for i in l:
		if i & 1:
			o += 1
		else:
			e += 1
	if e == n or o == n:
		pr('YES')
	else:
		pr('NO')
for _ in range(inp()):
	solve()


def hello(arr, p):
	count = 0
	odd = 0
	for i in p:
		if i == 0:
			return 'no'
		elif i % 2 == 0:
			count += i
		else:
			odd += 1
	if odd == 0 or count == 0:
		return 'yes'
	else:
		return 'no'
t = int(input())
for i in range(t):
	arr = int(input())
	p = list(map(int, input().split()))
	print(hello(arr, p))


def play_tetris(*column_height):
	lowest_column = min(column_height)
	if lowest_column % 2 == 0:
		for column in column_height:
			if column % 2 != 0:
				print('NO')
				return
		else:
			print('YES')
	elif lowest_column % 2 == 1:
		for column in column_height:
			if column % 2 != 1:
				print('NO')
				return
		else:
			print('YES')
_rounds = int(input())
column_amount_amount = []
column_height_amount = []
for _ in range(_rounds):
	_column_amount = int(input())
	_column_height = list(map(int, input().split()))
	column_amount_amount.append(_column_amount)
	column_height_amount.append(_column_height)
for caa in column_height_amount:
	play_tetris(*caa)


no_tests = int(input())
ans = []
while no_tests > 0:
	length = int(input())
	cols = list(map(int, input().split()))
	if len(cols) <= 1:
		ans.append('YES')
	else:
		odd = 0
		even = 0
		flag = 0
		for i in cols:
			if i % 2 == 0:
				even += 1
			else:
				odd += 1
		if even >= 1 and odd >= 1:
			ans.append('NO')
		elif odd == 0 and even >= 1:
			ans.append('YES')
		elif even == 0 and odd >= 1:
			ans.append('YES')
	no_tests -= 1
for i in range(len(ans)):
	if i == len(ans) - 1:
		print(ans[i], end='')
	else:
		print(ans[i])


t = int(input())
for i in range(t):
	n = int(input())
	num1 = list(map(int, input().split()))
	s = 0
	a = 0
	for i in num1:
		if i % 2 == 0:
			s += 1
		else:
			a += 1
	if s == len(num1) or a == len(num1):
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	even = 0
	odd = 0
	for i in range(len(l)):
		if l[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd == 0 or even == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if len(a) == 1:
		print('YES')
	else:
		b = max(a)
		d = 1
		for i in range(len(a)):
			if (b - a[i]) % 2 == 0:
				continue
			else:
				d = 0
				break
		if d == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = max(a) % 2
	ok = True
	for i in range(n):
		if a[i] % 2 != s:
			ok = False
			break
	print('YES' if ok else 'NO')


from math import gcd
for _ in range(int(input())):
	n = int(input())
	arr = [int(num) for num in input().split(' ')]
	g = []
	a = max(arr)
	for item in arr:
		g.append(a - item)
	gc = g[0]
	for i in range(1, n):
		gc = gcd(gc, g[i])
	if gc % 2 == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	int(input())
	print('YES' if len(set(map(lambda x: x % 2, map(int, input().split(' '))))) == 1 else 'NO')


t = int(input())
for i in range(t):
	odd = even = 0
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	for x in a:
		if x % 2 == 0:
			even += 1
		else:
			odd += 1
		if even >= 1 and odd >= 1:
			break
	if even == 0 or odd == 0:
		print('YES')
	else:
		print('NO')


def answer(n, ary):
	for i in range(n - 1):
		if ary[i] % 2 != ary[i + 1] % 2:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	n = [0] * t
	ary = []
	for j in range(t):
		n[j] = int(input())
		ary.append([int(i) for i in input().split()])
	for j in range(t):
		print(answer(n[j], ary[j]))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	q = max(a)
	t1 = 0
	q1 = 0
	if q == 0:
		print('YES')
	else:
		for i in a:
			if (q - i) % 2 == 0:
				t1 += 1
	if n == t1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = a[0] % 2
	ans = False
	for i in range(1, n):
		if a[i] % 2 != m:
			print('NO')
			ans = True
			break
	if not ans:
		print('YES')


for t in range(int(input())):
	e = 0
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort(reverse=True)
	for j in range(1, n):
		if (l[0] - l[j]) % 2 != 0:
			e += 1
	if e == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	failed = False
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	for i in range(1, n):
		if (arr[i] - arr[i - 1]) % 2 != 0:
			failed = True
			break
	if failed:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	(o, e) = (0, 0)
	for i in range(n):
		if arr[i] % 2 == 0:
			e += 1
		else:
			o += 1
	if o * e == 0:
		print('YES')
	else:
		print('NO')


import sys

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		a = [int(x) for x in sys.stdin.readline().split(' ')]
		if all((x % 2 == 0 for x in a)) or all((x % 2 == 1 for x in a)):
			print('YES')
		else:
			print('NO')
main()


for i in range(int(input())):
	n = int(input())
	t = list(map(int, input().split()))[0:n]
	v = [t[i + 1] - t[i] for i in range(len(t) - 1)]
	for j in v:
		if j % 2 != 0:
			print('no')
			break
	else:
		print('yes')


for cases in range(int(input())):
	k = int(input())
	lst = list(map(int, input().split()))
	odd = []
	even = []
	for i in range(k):
		if lst[i] % 2 == 0:
			even.append(lst[i])
		else:
			odd.append(lst[i])
	if len(odd) == k:
		print('YES')
	elif len(even) == k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	i = int(input())
	n = [*map(int, input().split())]
	n = list(map(lambda x: x % 2, n))
	print('NYOE S'[sum(n) == len(n) or sum(n) == 0::2])


import sys
sys.setrecursionlimit(10 ** 9)
from collections import defaultdict
IA = lambda : map(int, input().split())
t = int(input())
for i in range(t):
	n = int(input())
	vis = [int(-1) for i in range(n + 1)]
	a = list(IA())
	le = len(a)
	flag = 1
	t = a[0] & 1
	for i in range(1, le):
		if a[i] & 1 != t:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	ok = True
	i = 0
	while i < n and ok:
		if (a[i] - m) % 2 == 1:
			ok = False
		i += 1
	if ok:
		print('YES')
	else:
		print('NO')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	a = list(I())
	a = list(set(a))
	f = 0
	for x in a:
		for y in a:
			if abs(x - y) % 2 != 0:
				print('NO')
				f = 1
				break
		if f == 1:
			break
	if f == 0:
		print('YES')


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	n = getInt()
	a = getList()
	k = [0, 0]
	for i in range(n):
		k[a[i] % 2] += 1
	if k[0] > 0 and k[1] > 0:
		print('NO')
	else:
		print('YES')


import math
t = int(input())
for test in range(t):
	n = int(input())
	sizes = [int(i) for i in input().split(' ')]
	parity = sizes[0] % 2
	possible = True
	for s in sizes:
		if s % 2 != parity:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = input()
	A = list(map(int, list(a.split())))
	flag = 0
	for i in range(n):
		for j in range(i + 1, n):
			if abs(A[i] - A[j]) % 2 != 0:
				print('NO')
				flag = 1
				break
		if flag == 1:
			break
	if flag == 0:
		print('YES')


from math import *
for _ in range(int(input())):
	pr = 0
	n = int(input())
	a = [int(i) for i in input().split()]
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			if abs(a[j] - a[i]) % 2 != 0:
				pr = 1
				break
		if pr == 1:
			break
	if pr == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for j in range(n - 1):
		if (l[j] - l[j + 1]) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	temp = max(lst)
	flag = 0
	for i in lst:
		if (temp - i) % 2 != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k1 = 0
	k2 = 0
	for i in a:
		if i % 2 == 0:
			k1 += 1
		else:
			k2 += 1
	if k1 != 0 and k2 != 0:
		print('NO')
	else:
		print('YES')


a = int(input())
c = []
for i in range(a):
	b = int(input())
	d = input().split()
	for j in range(b):
		d[j] = int(d[j])
	c.append(d)
for i in c:
	check = 1
	p = i[0] % 2
	for j in i:
		if j % 2 != p:
			check = 0
			break
	if check == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = [0, 0]
	for i in a:
		flag[i % 2] = 1
	if sum(flag) == 2:
		print('NO')
		continue
	print('YES')


def verify(arr, parity):
	if len(arr) > 1:
		for i in range(len(arr)):
			if arr[i] % 2 != parity:
				return False
	return True

def main():
	ncases = int(input())
	for i in range(ncases):
		ncol = int(input())
		arr = [int(i) for i in input().split()]
		parity = arr[0] % 2
		if verify(arr, parity):
			print('YES')
		else:
			print('NO')
main()


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	maxi = max(a)
	flag = 0
	for height in a:
		if (maxi - height) % 2 != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	flag = 1
	lol = [int(o) for o in input().split()]
	if len(lol) == 1:
		if lol[0] > 0:
			print('YES')
		else:
			print('NO')
		continue
	for lol1 in lol:
		if (max(lol) - lol1) % 2 != 0:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in [*open(0)][2::2]:
	arr = list(map(int, _.split()))
	print(['NO', 'YES'][len([i for i in arr if i % 2 == 0]) in [0, len(arr)]])


for _ in range(int(input())):
	input()
	a = list(map(int, input().split()))
	m = max(a)
	flag = True
	for i in a:
		if (m - i) % 2 != 0:
			flag = False
	if flag:
		print('YES')
	else:
		print('No')


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	k = 0
	for i in range(a):
		if (max(b) - b[i]) % 2 == 0:
			k += 1
	print('YES' if k == a else 'NO')


t = int(input())
N = []
St = []
Ans = []
odd = 0
even = 0
q = 0
for i in range(t):
	N.append(int(input()))
	St.append(input().split())
while q < len(N):
	for i in range(N[q]):
		if int(St[q][i]) % 2 == 0:
			even = even + 1
		if int(St[q][i]) % 2 != 0:
			odd = odd + 1
	if odd == N[q] or even == N[q]:
		Ans.append('YES')
	else:
		Ans.append('NO')
	q = q + 1
	even = 0
	odd = 0
for i in range(t):
	print(Ans[i])


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	chk = lst[0] % 2
	ans = 'YES'
	for j in lst:
		if j % 2 != chk:
			ans = 'NO'
			break
	print(ans)


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	a = mp()
	if n < 2:
		cout('YES\n')
	else:
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) % 2:
				cout('NO\n')
				break
		else:
			cout('YES\n')


q = int(input())
for u in range(q):
	n = int(input())
	q = list(map(int, input().split()))
	mn = min(q)
	q = [i - mn for i in q]
	for i in q:
		if i % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = input()
	a = [int(x) % 2 for x in input().split()]
	a = [x == a[0] for x in a]
	if all(a):
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
import sys
from bisect import bisect_left, bisect_right
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	arr = list(map(int, stdin.readline().strip().split(' ')))
	for i in range(len(arr)):
		arr[i] = arr[i] % 2
	flag = True
	if len(arr) == 1:
		flag = True
	else:
		for i in range(1, len(arr)):
			if arr[0] != arr[i]:
				flag = False
				break
	if flag:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


def sol():
	t = int(input())
	for _ in range(t):
		n = int(input())
		A = [1 if int(i) % 2 == 0 else 0 for i in input().split()]
		print('YES' if sum(A) == n or sum(A) == 0 else 'NO')
sol()


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = list(map(int, input().split()))
		flag = True
		for i in range(N):
			if A[i] % 2 != A[0] % 2:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


testcase = int(input())
while testcase > 0:
	a = int(input())
	x = input()
	b = list(map(int, x.split(' ')))
	minimum = min(b)
	flag = 0
	for i1 in b:
		if (i1 - minimum) % 2 != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	testcase -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 'YES'
	for j in l:
		d = j - l[0]
		if d % 2 != 0:
			ans = 'NO'
	print(ans)


t = int(input())
for z in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		a.sort()
		r = 0
		for j in range(n - 1):
			if (a[j + 1] - a[j]) % 2 != 0:
				r = 1
				break
		if r == 0:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	n = int(input())
	it = map(int, input().split())
	odd = []
	even = []
	for i in it:
		even.append(i % 2 == 0)
		odd.append(i % 2 != 0)
	if all(even) or all(odd):
		print('YES')
	else:
		print('NO')


t = int(input())
for ti in range(t):
	n = int(input())
	P = list(map(int, input().split()))
	ANS = 1
	for i in range(1, n):
		if P[i] % 2 != P[0] % 2:
			ANS = 0
	if ANS == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	d = []
	for i in range(n - 1):
		d.append(abs(a[i] - a[i + 1]))
	c = 0
	for i in d:
		if i % 2 == 0:
			continue
		c = 1
		break
	if c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	min_a_i = min(a)
	possible = True
	for a_i in a:
		if (a_i - min_a_i) % 2 == 1:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	k = int(input())
	s = sum([int(x) % 2 for x in input().split()])
	if s == 0 or s == k:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	list = [int(x) for x in input().split()]
	var1 = 0
	var2 = 0
	for i in list:
		if i % 2 == 0:
			var1 += 1
		else:
			var2 += 1
	if var1 != 0 and var2 != 0:
		print('NO')
	else:
		print('YES')


t = int(input())
t2 = 2 * t
for _ in range(t):
	cols = int(input())
	heights = [int(x) for x in input().split()]
	canceled = False
	for c in range(1, cols):
		if heights[c] % 2 != heights[c - 1] % 2:
			print('NO')
			canceled = True
			break
	if canceled is False:
		print('YES')


from functools import reduce
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		n = Read.int()
		a = Read.list_int()
		max_a = max(a)
		flag = True
		for i in a:
			if (max_a - i) % 2 != 0:
				flag = False
				break
		if flag:
			print('yes')
		else:
			print('no')
main()


from sys import stdin
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	nums = list(map(int, stdin.readline().strip().split()))
	nums.sort()
	prev = nums[0]
	ans = 'YES'
	for num in nums[1:]:
		if (num - prev) % 2 == 1:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	(oc, ec) = (0, 0)
	for i in l:
		if i % 2 == 0:
			ec += 1
		else:
			oc += 1
	if ec == a or oc == a:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = max(a)
	ans = 'YES'
	for i in range(n):
		if abs(a[i] - b) % 2:
			ans = 'NO'
			break
	print(ans)


n = int(input())
l1 = []
l2 = []
for i in range(n):
	l1.append(int(input()))
	l2.append([int(x) for x in input().split()])
for i in range(n):
	a = 0
	b = 0
	for j in l2[i]:
		if j % 2 == 0:
			a = a + 1
		else:
			b = b + 1
	if min(a, b) == 0:
		print('YES')
	else:
		print('NO')
print()


tests = int(input())
for i in range(tests):
	x = int(input())
	a = input().split()
	for u in range(x):
		a[u] = int(a[u]) % 2
	if sum(a) % x == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	d = 0
	for i in a:
		if i % 2 == 0:
			c += 1
		if i % 2 == 1:
			d += 1
	if c == 0:
		print('YES')
	elif d == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	blocks = list(map(int, input().split()))
	count = 0
	for x in range(n):
		if blocks[x] % 2 == 0:
			count += 1
	if count < n and count != 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	cur = lis[0]
	flag = 0
	for i in range(1, n):
		if (cur - lis[i]) % 2 != 0:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	done = False
	for i in range(1, n):
		if (a[i] - a[i - 1]) % 2 == 1:
			done = True
			print('NO')
			break
	if not done:
		print('YES')


import sys
from math import ceil, sqrt
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []
for _ in range(cin()):
	n = cin()
	a = li()
	(od, ev) = (0, 0)
	for el in a:
		if el % 2 == 0:
			ev += 1
		else:
			od += 1
	if od and ev:
		print('no')
	else:
		print('yes')


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
cat = ''.join
catn = '\n'.join
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]

def solve():
	n = ri()
	a = ris()
	p = a[0] & 1
	for x in a:
		if x & 1 != p:
			return 'NO'
	return 'YES'
t = ri()
for _ in range(t):
	print(solve())


t = int(input())
for i in range(t):
	n = int(input())
	ai = list(map(int, input().split()))
	ai.sort()
	flag = True
	for i in range(len(ai) - 1):
		if (ai[i] - ai[i + 1]) % 2 != 0:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


def solve(n, d):
	if n == 1:
		return 'YES'
	parity = d[0] % 2
	for i in range(1, n):
		curr = d[i] % 2
		if curr != parity:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		d = input()
		d = [int(i) for i in d.split()]
		ans = solve(n, d)
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	ans = 'YES'
	for i in range(n):
		if (a[i] - m) % 2 == 1:
			ans = 'NO'
			break
	print(ans)


num = int(input())
for i in range(0, num):
	n = int(input())
	a = [int(i) for i in input().split()]
	true = 0
	for i in range(0, len(a) - 1):
		if a[i] % 2 == 0 and a[i + 1] % 2 == 1 or (a[i] % 2 == 1 and a[i + 1] % 2 == 0):
			print('NO')
			true = 1
			break
	if true == 0:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	count = 0
	flag = 0
	for i in range(n):
		if a[i] % 2 == 0:
			count = count + 1
		else:
			flag = flag + 1
	if count == n or flag == n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	c = 0
	for i in range(len(lst)):
		if lst[0] % 2 == 0:
			if lst[i] % 2 == 0:
				c += 1
		elif lst[i] % 2 != 0:
			c += 1
	if c == len(lst):
		print('YES')
	else:
		print('NO')


import sys
try:
	sys.stdin = open(sys.path[0] + '\\input.txt', 'r')
	sys.stdout = open(sys.path[0] + '\\output.txt', 'w')
except Exception as e:
	pass
for tc in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	mini = min(arr)
	for i in range(n):
		arr[i] -= mini
	maxi = max(arr)
	for i in arr:
		if (maxi - i) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = str(input())
	a = a.split()
	x = 0
	even = []
	odd = []
	for i in a:
		a[x] = int(a[x])
		x += 1
	x = 0
	for i in a:
		if i % 2 == 0:
			even.append(a[x])
		else:
			odd.append(a[x])
		x += 1
	if len(even) > 0:
		if len(odd) != 0:
			print('NO')
		else:
			print('YES')
	elif len(even) != 0:
		print('NO')
	else:
		print('YES')


def is_from_same(arr):
	model = arr[0]
	for i in range(1, len(arr)):
		if arr[i] != model:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	print('YES' if is_from_same(list(map(lambda a: int(a) % 2, input().split()))) else 'NO')


def teris(n, arr):
	maxi = max(arr)
	count = 0
	for i in range(n):
		if (maxi - arr[i]) % 2 == 0:
			count += 1
		else:
			break
	if count == n:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(teris(n, arr))


def es_par(num):
	if num % 2 == 0:
		return True
	else:
		return False
for test in range(int(input())):
	A = int(input())
	B = list(map(int, input().split()))
	empty = []
	for number in range(A):
		valor = es_par(B[number])
		empty.append(valor)
	if True in empty and False in empty:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	x = int(input())
	mylist = list(map(int, input().split()))
	mn = min(mylist)
	for i in range(x):
		mylist[i] -= mn
	flag = True
	for i in range(x):
		if mylist[i] % 2 != 0:
			flag = False
			break
	print('YES' if flag == True else 'NO')


t = int(input())
for i in range(t):
	ok = True
	n = int(input())
	heights = list(map(int, input().split()))
	for j in range(len(heights)):
		if heights[j] % 2 != heights[0] % 2:
			ok = False
	if ok == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = [0] * 2
	for i in arr:
		if i % 2 == 0:
			d[0] += 1
		else:
			d[1] += 1
	if d[0] != 0 and d[1] == 0:
		print('YES')
	elif d[0] == 0 and d[1] != 0:
		print('YES')
	else:
		print('NO')


import collections
t = int(input())
for q in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	flage = 0
	flago = 0
	for i in range(0, n):
		if a[i] % 2 == 0:
			flage = 1
			break
	for i in range(0, n):
		if a[i] % 2 != 0:
			flago = 1
			break
	if flage == 1 and flago == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = list(filter(lambda m: m % 2 == 0, a))
	if len(x) == 0 or len(x) == len(a):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	arr = [list(map(int, input().split())) for i in 'aa'][1]
	print('YNEOS'[not all((abs(arr[i] - arr[i + 1]) % 2 == 0 for i in range(len(arr) - 1)))::2])


from sys import stdin, stdout
for i1 in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	co = 0
	ce = 0
	for i in range(n):
		if a[i] % 2 == 0:
			ce += 1
		else:
			co += 1
	if co == n or ce == n:
		print('YES')
	else:
		print('NO')


x = int(input())
while x:
	n = int(input())
	xl = list(map(int, input().split(' ')))
	countArr = [0 for i in range(2)]
	for i in range(n):
		countArr[xl[i] % 2] += 1
	if countArr[0] > 0 and countArr[1] > 0:
		print('NO')
	else:
		print('YES')
	x -= 1


testcases = int(input())
for i in range(testcases):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = [i % 2 for i in arr]
	if n == 1:
		print('YES')
	elif arr.count(arr[0]) == len(arr) or arr.count(arr[0]) == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	arr = [int(i) for i in input().split()]
	maximum = max(arr)
	for i in arr:
		if (maximum - i) % 2 == 0:
			con = True
		elif (maximum - i) % 2 != 0:
			con = False
			break
	if con is True:
		print('YES')
	elif con is False:
		print('NO')


q = int(input())
for i in range(q):
	n = int(input())
	a = [int(i) for i in input().split()]
	for i in range(1, len(a)):
		if a[i] % 2 != a[i - 1] % 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	box = list(map(int, input().split()))
	tet = []
	for i in box:
		if i % 2 == 0:
			tet.append(0)
		else:
			tet.append(1)
	tet = set(tet)
	if len(tet) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = map(int, input().split())
	ct1 = 0
	ct2 = 0
	for c in l:
		if c % 2 == 0:
			ct1 += 1
		else:
			ct2 += 1
	if ct1 == n or ct2 == n:
		print('YES')
	else:
		print('NO')


def solve(lst):
	ind = lst.index(max(lst))
	for i in range(len(lst)):
		if i == ind:
			continue
		if (lst[ind] - lst[i]) % 2 != 0:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	cols_size = list(map(int, input().split()))
	ans = solve(cols_size)
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if arr.count(1) == len(arr):
		print('YES')
		continue
	if arr.count(arr[0]) == len(arr):
		print('YES')
		continue
	arr.sort()
	flag = 0
	for i in range(n - 1):
		if (arr[i + 1] - arr[i]) % 2 != 0:
			print('NO')
			flag = 1
			break
	if flag:
		continue
	print('YES')


n = int(input())
for i in range(n):
	k = int(input())
	f = 1
	a = list(map(int, input().split()))
	if k == 1:
		print('YES')
	else:
		for j in range(k - 1):
			if abs(a[j] - a[j + 1]) % 2 == 1:
				print('NO')
				f = 0
				break
		if f == 1:
			print('YES')


for _ in range(int(input())):
	size = int(input())
	l = list(map(int, input().split()))
	flag = 0
	for i in range(size - 1):
		if abs(l[i] - l[i + 1]) % 2 != 0:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


for i in range(int(input())):
	n = int(input())
	t = input().split(' ')
	sum = 0
	for m in range(n):
		t[m] = int(t[m]) % 2
		if t[m] == 1:
			sum += 1
	if sum == n or sum == 0:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	judge1 = None
	judge2 = True
	for i in range(n):
		if judge1 == None and a[i] % 2 == 0:
			judge1 = True
		elif judge1 == None and a[i] % 2 != 0:
			judge1 = False
		elif judge1 == False and a[i] % 2 == 0:
			judge2 = False
			break
		elif judge1 == True and a[i] % 2 != 0:
			judge2 = False
			break
	if judge2 == True:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	maxx = max(a)
	q = True
	if n == 1:
		print('YES')
	else:
		for i in range(n):
			a[i] = maxx - a[i]
		for i in range(n):
			if a[i] % 2 != 0:
				print('NO')
				q = False
				break
			else:
				q = True
		if q == True:
			print('YES')


a = int(input())
r = 0
m = list()
while r < a:
	input()
	c = [int(c) for c in input().split()]
	d = max(c)
	s = 0
	e = 0
	while s < len(c):
		if (d - c[s]) % 2 == 0:
			s = s + 1
			continue
		else:
			e = 1
			break
	r = r + 1
	if e == 1:
		m.append('NO')
	else:
		m.append('YES')
r = 0
while r < a:
	print(m[r])
	r = r + 1


t = int(input())
i = 0
while i < t:
	n = int(input())
	arr = list(map(int, input().split()))
	even = 0
	odd = 0
	for x in arr:
		if x % 2 == 0:
			even = even + 1
		else:
			odd = odd + 1
	if even != 0 and odd == 0:
		print('YES')
	elif even == 0 and odd != 0:
		print('YES')
	else:
		print('NO')
	i = i + 1


t = int(input())
for tt in range(t):
	n = int(input())
	a = input().split(' ')
	for x in range(n):
		a[x] = int(a[x])
	if n == 1:
		print('YES')
	else:
		j = a[0] % 2
		for i in range(1, n):
			if a[i] % 2 != j:
				print('NO')
				break
			elif i == n - 1:
				print('YES')
				break


from sys import stdin, stdout
(_input, _print) = (stdin.readline, stdout.write)
(_range, _int, _list, _len, _str) = (range, int, list, len, str)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		arr = [int(i) for i in input().split()]
		chet_count = 0
		nechet_count = 0
		for i in arr:
			if i % 2 == 0:
				chet_count += 1
			elif i % 2 == 1:
				nechet_count += 1
			if chet_count > 0 and nechet_count > 0:
				print('NO')
				break
		else:
			print('YES')
solution()


import sys

def evenodd(elm):
	if elm % 2 == 0:
		return 'e'
	else:
		return 'o'

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		l = list(map(int, input().strip().split()))
		sm = min(l)
		didbreak = False
		for elm in l:
			if (elm - sm) % 2 != 0:
				didbreak = True
				break
		if not didbreak:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	deff = 0
	a = list(map(int, input().split()))
	curr = a[0] % 2
	for j in range(n):
		if a[j] % 2 != curr and deff == 0:
			print('NO')
			deff = 1
	if deff == 0:
		print('YES')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(len(a) - 1):
		if (a[i + 1] - a[i]) % 2 != 0:
			print('NO')
			return
	print('YES')
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ps = True
	for i in a:
		for j in a:
			if abs(i - j) % 2 != 0:
				ps = False
				break
		if not ps:
			break
	if ps:
		print('YES')
	else:
		print('NO')


data = input().rstrip().split()
t = int(data[0])

def f(n, arr):
	arr2 = [i % 2 for i in arr]
	if min(arr2) == max(arr2):
		return 'YES'
	else:
		return 'NO'
for i in range(t):
	n = input().rstrip().split()
	n = int(n[0])
	data = input().rstrip().split()
	print(f(n, [int(d) for d in data]))


from __future__ import division, print_function

def get_ints():
	return map(int, input().strip().split())

def get_array():
	return list(map(int, input().strip().split()))
from math import pow, gcd
from random import randint

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = get_array()
		if n == 1:
			print('YES')
			continue
		flag = True
		for i in range(n - 1):
			if abs(arr[i + 1] - arr[i]) & 1:
				flag = False
		if flag:
			print('YES')
		else:
			print('NO')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
for i in range(n):
	n1 = int(input())
	m = list(map(int, input().split()))
	(c, d) = (0, 0)
	for n in m:
		if n % 2 == 0:
			c += 1
		else:
			d += 1
	if min(c, d) == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	a = int(input())
	b = input()
	b = [int(j) for j in b.split()]
	c = []
	for j in b:
		if j % 2 == 0:
			c.append(True)
		else:
			c.append(False)
	c = set(c)
	if len(c) == 1:
		print('YES')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	temp = l[0]
	for i in range(len(l)):
		l[i] -= temp
	odd = 0
	if l[0] % 2 != 0:
		odd = 1
	for i in range(len(l)):
		if l[i] % 2 != odd:
			print('NO')
			break
		if i == len(l) - 1:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	ok1 = 0
	ok2 = 0
	a = list(map(int, input().split()))
	for i in range(n):
		if a[i] % 2:
			ok1 = 1
		else:
			ok2 = 1
	if ok1 and ok2:
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = sorted(list(set(a)))
	c = []
	for j in range(len(b) - 1):
		c.append((b[j + 1] - b[j]) % 2)
	if 1 in c:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	am = [(x - min(a)) % 2 for x in a]
	print('YES' if sum(am) == 0 else 'NO')


import math
import collections
import functools
import sys
import os

def solve():
	_ = input()
	table = list(map(int, input().split(' ')))
	mx = max(table)
	for item in table:
		if (mx - item) % 2:
			print('NO')
			return
	print('YES')

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	maximum = a[0]
	for j in range(1, n):
		maximum = max(maximum, a[j])
	count = 0
	for j in range(n):
		if (maximum - a[j]) % 2:
			count += 1
			break
	if count:
		print('NO')
	else:
		print('YES')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	minn = min(a)
	isOdd = lambda a: a % 2 != 0
	ch = True
	for i in range(len(a)):
		a[i] -= minn
		if isOdd(a[i]):
			ch = False
			print('NO')
			break
	if ch:
		print('YES')
for _ in range(int(input())):
	main()


for _ in range(int(input())):
	input()
	a = sorted(list(set(map(int, input().split()))), reverse=True)
	if len(a) > 1:
		result = ''
		for i in range(len(a) - 1):
			if (a[i] - a[i + 1]) % 2 == 1:
				result = 'NO'
				break
		if result:
			print(result)
		else:
			print('YES')
	else:
		print('YES')


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n, lst):
	maxx = max(lst)
	diff = []
	for i in lst:
		diff.append(maxx - i)
	for i in diff:
		if i % 2:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(solve(n, lst))


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = max(l1)
	flag = 0
	for i in range(n):
		if (m - l1[i]) % 2 != 0:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	count = 0
	A = [int(x) for x in input().split()]
	for i in range(N - 1):
		for j in range(i + 1, N):
			if abs(A[i] - A[j]) % 2 != 0:
				count = 1
				break
		if count == 1:
			break
	if count == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	x = int(input())
	l = list(map(int, input().split()))
	p = max(l)
	q = 0
	for i in l:
		if (p - i) % 2 == 0:
			q += 1
	if q == len(l):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	odd = 0
	even = 0
	for a_i in a:
		if a_i % 2 == 1:
			odd += 1
		else:
			even += 1
	print('YES' if odd == 0 or even == 0 else 'NO')


T = int(input().strip())
for t in range(T):
	N = int(input().strip())
	A = list(map(int, input().split()))
	m = max(A)
	status = 'YES'
	for a in A:
		if a < m and (m - a) % 2 == 1:
			status = 'NO'
			break
	print(status)


import math
import itertools
gh = lambda : map(int, input().split())
mod = 998244353
mod = int(mod)

def main():
	t = int(input())
	while t:
		t -= 1
		input()
		d = [0] * 120
		mx = 0
		for i in list(gh()):
			d[i] = 1
			mx = max(mx, i)
		i = 1
		tr = False
		while i <= mx:
			if tr == 0 and d[i] > 0:
				tr = 1
			d[i] = 0
			i += 1 + tr
		print('YNEOS'[max(d) > 0::2])
main()


a = int(input())
for j in range(a):
	n = int(input())
	l = list(map(int, input().split()))
	a = max(l)
	k = 1
	for i in range(n):
		if (a - l[i]) % 2:
			print('NO')
			k = 0
			break
	if k:
		print('YES')


def program():
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
		return 0
	if n == 2 and l[0] == l[1]:
		print('YES')
		return 0
	m = min(l)
	for x in l:
		if (x - m) % 2 != 0:
			print('NO')
			return 0
	print('YES')
t = int(input())
for i in range(t):
	program()


for x in range(int(input())):
	n = int(input())
	a = list(filter(lambda x: int(x) % 2 == 0, input().split()))
	if len(a) == 0 or len(a) == n:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
for i in range(ip()):
	n = ip()
	li = ai()
	x = min(li)
	c = 0
	li = [i - x for i in li]
	for i in li:
		if i % 2:
			print('NO')
			c += 1
			break
	if c == 0:
		print('YES')


t = int(input())
for w in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	if n == 1:
		print('YES')
		continue
	m = max(a)
	y = 0
	for i in a:
		if (m - i) % 2 == 0:
			y = 1
		else:
			y = 0
			print('NO')
			break
	if y == 1:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	if n == 1:
		print('YES')
	else:
		m = min(a)
		for i in a:
			if m - i != 0 and abs(m - i) % 2 != 0:
				flag = 1
				break
			if abs(m - i) == 1:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	n_columns = int(input())
	columns = [int(x) for x in input().split()]
	even = False
	odd = False
	for column in columns:
		if column % 2 == 0:
			even = True
		else:
			odd = True
	if even ^ odd:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split(' ')))
	min_len_col = min(A)
	flag = True
	for j in range(len(A)):
		if (A[j] - min_len_col) % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	num = int(input())
	l1 = list(map(int, input().split()))
	count = 0
	for j in range(num):
		for k in range(num):
			if abs(l1[j] - l1[k]) % 2 != 0:
				print('No')
				count = 1
				break
		if count == 1:
			break
	if count == 0:
		print('Yes')


t = int(input())
for i in range(t):
	n = int(input())
	colunasAltura = [int(p) for p in input().split()]
	impar = 0
	par = 0
	for i in colunasAltura:
		if i % 2 == 0:
			par += 1
		else:
			impar += 1
	if par > 0 and impar > 0:
		print('NO')
	else:
		print('YES')


def solve(a):
	evens = sum(map(lambda x: x % 2 == 0, a))
	return evens == 0 or evens == len(a)
for i in range(int(input())):
	n = int(input())
	print('YES' if solve([int(x) for x in input().split()]) else 'NO')


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda : list(map(int, input().split()))

def case():
	n = int(input())
	a = li()
	c = 0
	for i in a:
		if i % 2 == 0:
			c += 1
	if c == 0 or c == n:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	case()


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

	def S():
		return stdin.readline().rstrip()

	def Sn():
		return stdin.readline().split(' ')

def func(l):
	n = len(l)
	k = l[0] % 2
	for i in l:
		if i % 2 != k:
			return 'NO'
	return 'YES'
st = ''
for _ in range(I()):
	n = I()
	l = list(In())
	ans = str(func(l))
	st = '\n'.join((st, ans))
print(st.lstrip())


def tetris(N, a):
	even = a[0] % 2
	for i in a:
		if i % 2 != even:
			return 'NO'
	else:
		return 'YES'
T = int(input())
for i in range(T):
	N = int(input())
	a = list(map(int, input().split()))
	print(tetris(N, a))


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
T = int(input())
for i in range(T):
	n = int(input())
	ls = list(map(int, input().split()))
	m = min(ls)
	for i in ls:
		if (i - m) % 2:
			print('NO\n')
			break
	else:
		print('YES\n')


T = int(input())
for t in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	c = int(a[0] % 2)
	z = False
	for x in a:
		z = int(x % 2) != c
		if z:
			break
	if not z:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()

def zap():
	n = int(input())
	a = list(map(int, input().split()))
	c = min(a)
	for i in range(n):
		a[i] -= c
	for i in a:
		if i % 2 == 0:
			continue
		else:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(zap())


def main():
	Q = int(input())
	for query in range(Q):
		N = int(input())
		A = [int(i) for i in input().split()]
		mi = min(A)
		if all(((a - mi) % 2 == 0 for a in A)):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	count_odd = 0
	count_even = 0
	for i in range(n):
		if arr[i] % 2 != 0:
			count_odd += 1
		else:
			count_even += 1
	if count_odd == n or count_even == n:
		print('Yes')
	else:
		print('NO')


import sys

def solve():
	input = sys.stdin.readline
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = [int(a) for a in input().split()]
		minhight = min(A)
		for (i, a) in enumerate(A):
			if (a - minhight) % 2 == 1:
				print('No')
				break
		else:
			print('Yes')
	return 0
solve()


m = int(input())
for i in range(m):
	n = int(input())
	b = True
	mas = list(map(int, input().split()))
	if mas[0] % 2 == 0:
		for i in mas:
			if i % 2 == 1:
				b = False
				break
	else:
		for i in mas:
			if i % 2 == 0:
				b = False
				break
	if b:
		print('YES')
	else:
		print('NO')


t = int(input())
i = 0
while i < t:
	a = int(input())
	x = list(map(int, str(input()).split()))
	x.sort()
	j = 0
	while j < a - 1:
		if (x[j + 1] - x[j]) % 2 != 0:
			print('NO')
			break
		j += 1
	else:
		print('YES')
	i += 1


t = int(input())
for case_num in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	ok = True
	for i in range(n - 1):
		if (a[i + 1] - a[i]) % 2 != 0:
			ok = False
			break
	print('YES' if ok else 'NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = l[0] % 2
	f = True
	for i in range(1, n):
		if l[i] % 2 != c:
			print('NO')
			f = False
			break
	if f:
		print('YES')


N = int(input())
n = [0 for i in range(N)]
data = [0 for i in range(N)]
split = [0 for i in range(N)]
res = [0 for i in range(N)]
possible = [True for i in range(N)]
numbers = [[] for i in range(N)]
for i in range(N):
	n[i] = int(input())
	data[i] = input()
	split[i] = data[i].split(' ')
for i in range(N):
	for j in split[i]:
		numbers[i].append(int(j))
for i in range(N):
	for j in range(n[i]):
		if numbers[i][j] % 2 != numbers[i][0] % 2:
			possible[i] = False
for i in range(N):
	if possible[i]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	p = a[0] % 2
	full = True
	for i in a[1:]:
		if i % 2 != p:
			full = False
	if full:
		print('YES')
	else:
		print('NO')


def solve(a, n):
	even_oneven = [num % 2 for num in a]
	if sum(even_oneven) == 0 or sum(even_oneven) == n:
		return 'YES'
	return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	y = solve(a, n)
	print(y)


t = int(input())
for ts in range(t):
	l = int(input())
	a = sum([int(i) % 2 for i in input().split()])
	if a == 0 or a == l:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	for j in range(n):
		a[j] = int(a[j])
	while a.count(0) == 0:
		s = min(a)
		for k in range(n):
			a[k] = a[k] - s
	for j in range(n):
		if a[j] % 2 != 0:
			print('NO')
			break
	else:
		print('YES')


T = int(input())
for i in range(T):
	N = int(input())
	l = [int(x) for x in input().split()]
	f = 0
	l[0] = l[0] + 2
	l.sort()
	for j in range(1, len(l)):
		l[j] = l[j] - l[0]
	l[0] = 0
	s = 0
	for j in range(len(l)):
		if l[j] % 2 != 0:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


import re, math, decimal, bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]

def round(n):
	return int(n + 0.5)
DEBUG = 1

def debug(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)
t = iread()
for _ in range(t):
	n = iread()
	arr = viread()
	can = True
	for i in range(n - 1):
		if (arr[i] - arr[i + 1]) % 2 == 1:
			can = False
			break
	print(['NO', 'YES'][int(can)])


for _ in range(int(input())):
	n = int(input())
	field = list(map(int, input().split()))
	for i in range(1, len(field)):
		if (field[i] - field[0]) % 2 == 0:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict, Counter
import heapq
import math
import sys
import os
di = {}
arr = []
dd = defaultdict(list)

def solve():
	N = int(input())
	A = [int(i) for i in input().split(' ')]
	if len(list(filter(lambda x: x % 2 == 0, A))) == 0 or len(list(filter(lambda x: x % 2 == 0, A))) == N:
		print('YES')
	else:
		print('NO')
T = int(input())
for i in range(T):
	solve()


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

def lint():
	return list(map(int, input().split()))

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	n = aint()
	l = lint()
	odd = False
	even = False
	for i in l:
		if i % 2 == 1:
			odd = True
		else:
			even = True
	if odd and even:
		print('NO')
	else:
		print('YES')
t = int(input())
for i in range(t):
	main()


answer = []
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	parity = [0] * n
	for i in range(n):
		if a[i] % 2 == 0:
			parity[i] = 1
	if sum(parity) == 0 or sum(parity) == n:
		answer.append('YES')
	else:
		answer.append('NO')
print('\n'.join(answer))


for _ in range(int(input())):
	n = int(input())
	q = input().split()
	c = 0
	if n == 1:
		print('YES')
	else:
		for x in range(n):
			if int(q[x]) % 2 == 0:
				c += 1
		if c == 0 or c == n:
			print('YES')
		else:
			print('NO')


import collections
t = int(input())
for i in range(t):
	n = int(input())
	col = [int(j) for j in input().split()]
	fail = False
	parity = col[0] % 2
	for j in range(1, len(col)):
		if col[j] % 2 != parity:
			fail = True
			break
	if fail == False:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = max(a)
	fg = 0
	for i in range(0, n):
		if (b - a[i]) % 2 != 0:
			fg = 1
			break
	if fg == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = l[0]
	for j in range(len(l)):
		m = max(m, l[j])
	b = 0
	for j in range(n):
		if (m - l[j]) % 2 != 0:
			b = 1
			break
	if b == 1:
		print('NO')
	else:
		print('YES')


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	f = 1
	for i in range(0, n):
		a[i] = a[i] - m
	for i in range(0, n):
		if a[i] % 2 != 0:
			print('NO')
			f = 0
			break
	if f:
		print('YES')


for _ in range(int(input())):
	lens = int(input())
	hts = [int(x) for x in input().split()]
	if all([(max(hts) - x) % 2 == 0 for x in hts]):
		print('YES')
	else:
		print('NO')


def check(a):
	if a % 2 == 0:
		return True
	else:
		return False
for x in range(int(input())):
	n = int(input())
	lab = list(map(int, input().split()))
	lab2 = list(filter(check, lab))
	if len(lab2) == n or len(lab2) == 0:
		print('YES')
	else:
		print('NO')


def tetris(arr):
	m = max(arr)
	for i in arr:
		if (m - i) % 2 == 0:
			pass
		else:
			return 'NO'
	else:
		return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(tetris(arr))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	flag = False
	for i in range(n - 1):
		t = abs(arr[i] - arr[i + 1])
		if t != 0 and t % 2:
			print('NO')
			flag = True
			break
	if not flag:
		print('YES')


import math
import bisect
from itertools import groupby

def rints():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	n = int(input())
	s = rints()
	print('YES' if all((x % 2 for x in s)) or all((x % 2 == 0 for x in s)) else 'NO')


N = int(input())
for i in range(N):
	n = int(input())
	constantly = True
	A = list(map(int, input().split()))
	first = A[0] % 2
	for i in range(n - 1):
		if A[i + 1] % 2 != first:
			constantly = False
			break
	if constantly:
		print('YES')
	else:
		print('NO')


t = int(input())
for gg in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	c = a[0] % 2
	for i in a:
		if i % 2 != c:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	s = sum((i % 2 for i in a))
	print('YES' if s == 0 or s == n else 'NO')


def solution(column_array, columns):
	even = 0
	odd = 0
	for elem in column_array:
		if int(elem) % 2 == 0:
			even += 1
		else:
			odd += 1
	if even != 0 and odd != 0:
		return 'NO'
	return 'YES'
tests = int(input())
for i in range(tests):
	columns = int(input())
	current = input()
	current = current.split()
	if columns == 1:
		print('YES')
	else:
		print(solution(current, columns))


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	m = min(A)
	count = 0
	for i in A:
		if (i - m) % 2 == 0:
			count += 1
	if count == n:
		print('YES')
	else:
		print('NO')


c = int(input())
for i in range(c):
	n = int(input())
	l = list(map(int, input().split()))
	c = True
	for j in range(n - 1):
		if abs(l[j] - l[j + 1]) % 2 == 1:
			print('NO')
			c = False
			break
	if c:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = max(a)
	flag = 0
	for j in range(n):
		if (x - a[j]) % 2 != 0:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	tetris = list(map(int, input().split()))
	odd = 0
	even = 0
	for x in tetris:
		if x % 2 == 0:
			even += 1
		else:
			odd += 1
	if odd > 0 and even == 0:
		print('YES')
	elif odd == 0 and even > 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	t = int(input())
	s = list(map(int, input().split()))
	h = max(s)
	l = 0
	for i in range(len(s)):
		if (h - s[i]) % 2 == 0:
			l += 1
		else:
			break
	if l == len(s):
		print('YES')
	else:
		print('NO')


def can_be_solved(tetris_arg):
	min_height = min(tetris_arg)
	tetris = [x - min_height for x in tetris_arg]
	odd_exist = any(map(lambda x: x % 2 == 1, tetris))
	return not odd_exist
number_of_tests = int(input())
for _ in range(number_of_tests):
	input()
	tetris = [int(x) for x in input().split()]
	result = 'YES' if can_be_solved(tetris) else 'NO'
	print(result)


from sys import exit
for _ in range(int(input())):
	done = False
	n = int(input())
	a = [int(_) for _ in input().split()]
	parity = a[0] % 2
	for i in range(1, n):
		if a[i] % 2 != parity:
			print('NO')
			done = True
			break
	if not done:
		print('YES')


import math

def change_char(s, p, r):
	return s[:p] + r + s[p + 1:]

def gcd(i, j):
	(i, j) = map(int, [i, j])
	print(i, j)
	if i < j:
		(i, j) = (j, i)
	if j <= 0:
		return i
	x = gcd(j, i % j)
	return x
tests = int(input())
for test in range(tests):
	num = int(input())
	blocks = list(map(int, input().split()))
	odd = blocks[0] % 2 == 1
	answer = 'YES'
	for block in blocks[1:]:
		checker = block % 2 == 1
		if checker != odd:
			answer = 'NO'
			break
	print(answer)


import sys

def readInt():
	return int(rl())

def readList():
	return list(map(int, rl().strip().split()))

def readStr():
	return rl().strip()

def makeMatrix(a, b, value):
	z = [value] * a
	for i in range(a):
		z[i] = [value] * b
	return z
rl = input
tc = readInt()
while tc:
	tc -= 1
	n = readInt()
	a = readList()
	ok = True
	for i in range(1, n):
		ok = ok and (a[0] + a[i]) % 2 == 0
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(c) % 2 for c in input().split()]
	if ar.count(0) == 0 or ar.count(0) == n:
		print('YES')
	else:
		print('NO')


def solve(n, iarr):
	maxh = max(iarr)
	for e in iarr:
		if maxh - e & 1:
			return 'NO'
	return 'YES'
T = int(input())
for t in range(T):
	n = int(input())
	iarr = list(map(int, input().split()))
	print(solve(n, iarr))


testes = int(input())
for t in range(testes):
	size = int(input())
	colunas = list(map(int, input().split(' ')))
	par = 0
	impar = 0
	for k in range(size):
		if colunas[k] % 2 == 0:
			par += 1
		else:
			impar += 1
	if par > 0 and impar > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	n = input()
	lista = list(map(int, input().split()))
	lih = False
	if all([x % 2 == 0 for x in lista]) or all([x % 2 != 0 for x in lista]):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	heights = [int(h) for h in input().split()]
	(even, odd) = (False, False)
	for h in heights:
		if h % 2 == 0:
			even = True
		else:
			odd = True
	if even and odd:
		print('NO')
	else:
		print('YES')


n_tests = int(input())
for i in range(1, n_tests * 2, 2):
	n_cols = int(input())
	cols = list(map(int, input().split(' ')))
	if len(cols) == 1:
		print('YES')
		continue
	all_odd = all(map(lambda x: x % 2 != 0, cols))
	all_even = all(map(lambda x: x % 2 == 0, cols))
	if all_odd or all_even:
		print('YES')
		continue
	print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(odds, evens) = ([aa for aa in a if aa % 2 == 1], [aa for aa in a if aa % 2 == 0])
	print('YES' if not odds or not evens else 'NO')


t = int(input())
results = []
for test in range(t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	lst1 = [i for i in a if i % 2 == 0]
	lst2 = [i for i in a if i % 2 == 1]
	results.append('YES' if len(lst1) == 0 or len(lst2) == 0 else 'NO')
[print(item) for item in results]


import sys
import os

def changeStdioToFile():
	path = os.path.dirname(os.path.abspath(__file__))
	sys.stdin = open(f'{path}/input.txt', 'r')
	sys.stdout = open(f'{path}/output.txt', 'w')
t = 1
t = int(input())
for _ in range(t):
	n = int(input())
	print('YES' if sum((int(x) % 2 for x in input().split())) in (0, n) else 'NO')


for _ in range(int(input())):
	c = int(input())
	l = [int(i) for i in input().split()]
	even = [int(i) for i in l if i % 2 == 0]
	if len(even) == 0 or len(even) == len(l):
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	for i in range(1, n):
		if a[i] % 2 != a[i - 1] % 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for z in range(t):
	n = int(input())
	mx = -1
	columns = set(list(map(int, input().split())))
	mx = max(columns)
	answer = True
	for i in columns:
		if (mx - i) % 2 != 0:
			answer = False
			break
	if answer:
		print('YES')
	else:
		print('NO')


N = int(input())
for n in range(N):
	numCol = int(input())
	cols = [int(i) for i in input().split()]
	foundEven = False
	foundOdd = False
	for c in cols:
		if c % 2 == 1:
			foundOdd = True
		else:
			foundEven = True
		if foundOdd and foundEven:
			print('NO')
			break
	if not (foundOdd and foundEven):
		print('YES')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = li()
	m = min(l)
	for i in range(n):
		if l[i] == m:
			l[i] += 2
	m = min(l)
	l = [i - m for i in l]
	ans = 'YES'
	for i in range(n):
		if l[i] % 2:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = input()
	L = [int(x) for x in input().strip().split(' ')]
	L1 = [x % 2 for x in L]
	if len(set(L1)) == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = []
	arr = list(map(int, input().split()))
	for i in range(len(arr)):
		if arr[i] % 2 == 0:
			a.append(1)
		else:
			a.append(0)
	if len(set(a)) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = 'NO'
	l = list(map(int, input().split()))
	if all((i % 2 == l[0] % 2 for i in l)):
		a = 'YES'
	print(a)


for i in [0] * int(input()):
	n = int(input())
	a = list(map(int, input().split()))
	f = a[0] % 2
	for i in a:
		if i % 2 is not f:
			print('NO')
			f = -1
			break
	if f is not -1:
		print('YES')


t = int(input())
odd = False
even = False
ans = []
for i in range(t):
	odd = False
	even = False
	n = int(input())
	a = [int(i) for i in input().split()]
	for j in a:
		if j % 2 == 1:
			odd = True
		else:
			even = True
	if odd and even:
		ans.append('NO')
	else:
		ans.append('YES')
print('\n'.join((i for i in ans)))


def gcd(a: int, b: int):
	return a if b == 0 else gcd(b, a % b)

def solve(field: list):
	isOdd = False
	isEven = False
	for h in field:
		if h % 2 == 0:
			isEven = True
		if h % 2:
			isOdd = True
	return isEven != isOdd
tc = int(input())
for _ in range(tc):
	cols = int(input())
	field = [int(height) for height in input().split()]
	assert len(field) == cols, 'Invalid Test Case'
	print('YES' if solve(field) else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	if n <= 1:
		print('YES')
	else:
		evc = 0
		odc = 0
		for i in range(n):
			if al[i] % 2 == 0:
				evc += 1
			else:
				odc += 1
		if evc > 0 and odc > 0:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
tests = inp()
testcount = 0
while testcount < tests:
	columns = inp()
	tetris = inlt()
	arr = []
	i = 1
	while i < columns:
		arr.append((tetris[i] - tetris[i - 1]) % 2)
		i += 1
	if len(arr) == 0:
		print('YES')
	elif max(arr) == 1:
		print('NO')
	else:
		print('YES')
	testcount += 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = a[0] % 2
	ans = True
	for i in range(n):
		if a[i] % 2 == p:
			continue
		else:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


pp = print
li = list
tp = tuple
bg = 1000000000.0
sg = -1000000000.0
rd = round
ss = sorted
sj = ''.join
nl = '\n'

def solve():
	a = int(input())
	b = [*map(int, input().split())]
	for i in b:
		if i % 2 != b[0] % 2:
			print('NO')
			break
	else:
		print('YES')

def main():
	for i in range(int(input())):
		solve()
main()


t = int(input())
for g in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	v = a[0] % 2
	p = 0
	for i in range(1, n):
		if a[i] % 2 == v:
			continue
		else:
			p = 1
			break
	if p == 0:
		print('YES')
	else:
		print('NO')


for v in range(int(input())):
	n = int(input())
	x = [int(q) for q in input().split()]
	t = min(x)
	for i in range(len(x)):
		x[i] = x[i] - t
	c = 0
	for i in range(len(x)):
		if x[i] % 2 == 0:
			c += 1
	if c == len(x):
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0] % 2
	for i in a:
		if i % 2 != x:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	for _ in range(t):
		print(solve())
main()


try:
	t = int(input())
	for j in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		flag = 1
		if n == 1:
			print('YES')
			continue
		for i in range(n):
			if abs(a[i] - a[0]) % 2 != 0:
				print('NO')
				flag = 0
				break
		if flag == 0:
			continue
		print('YES')
except:
	pass


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	b = True
	if arr[0] % 2 == 1:
		for j in range(1, len(arr)):
			if arr[j] % 2 == 0:
				b = False
				break
	if arr[0] % 2 == 0:
		for j in range(1, len(arr)):
			if arr[j] % 2 == 1:
				b = False
				break
	if b == True:
		print('YES')
	else:
		print('NO')


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
for _ in range(ii()):
	n = ii()
	a = li()
	f = 1
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) % 2:
			f = 0
			break
	print(['NO', 'YES'][f])


for t in range(int(input())):
	coluna = int(input())
	lista = list(map(int, input().split()))
	flag = True
	for i in range(len(lista) - 1):
		if abs(lista[i] - lista[i + 1]) % 2 == 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for dum in range(t):
	n = int(input())
	a = input().split()
	a = list(map(int, a))
	mark = True
	for i in range(1, n):
		if a[0] % 2 != a[i] % 2:
			mark = False
			break
	if mark:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	a1 = False
	a2 = False
	for a in A:
		if a % 2 == 0:
			a1 = True
		else:
			a2 = True
	print('YES' if not a1 or not a2 else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	check = 0
	ok = max(a)
	for j in range(n):
		if (ok - a[j]) % 2 != 0:
			check += 1
	if check != 0:
		print('NO')
	else:
		print('YES')


ans = []
q = int(input())
for u in range(q):
	n = int(input())
	L = [int(x) for x in input().split()]
	even = True
	if L[0] % 2 != 0:
		even = False
	khalas = False
	for i in range(1, n):
		if L[i] % 2 == 0 and even == False:
			khalas = True
			ans.append('NO')
			break
		if L[i] % 2 != 0 and even == True:
			khalas = True
			ans.append('NO')
			break
	if khalas == False:
		ans.append('YES')
for x in ans:
	print(x)


T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	flag = 1
	while i < n - 1:
		if flag == 1:
			if arr[i] % 2 == 0 and arr[i + 1] % 2 == 0:
				i += 1
				continue
			elif arr[i] % 2 != 0 and arr[i + 1] % 2 != 0:
				i += 1
				continue
			else:
				print('NO')
				flag = 0
				break
			i += 1
		else:
			break
	if flag == 1:
		print('YES')


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():

	def ok(aa):
		mn = min(aa)
		for a in aa:
			if a - mn & 1:
				return False
		return True
	t = II()
	for _ in range(t):
		II()
		if ok(LI()):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
while t != 0:
	n = int(input())
	x = [int(i) for i in input().split()]
	m = min(x)
	for i in range(n):
		x[i] = x[i] - m
	flag = 1
	for i in x:
		if i % 2 == 1:
			flag = -1
			break
	if flag == 1:
		print('YES')
	elif flag == -1:
		print('NO')
	t = t - 1


tap = int(input())
for _ in range(tap):
	num = int(input())
	x = list(map(int, input().split()))
	o = 0
	for i in x:
		if i % 2:
			o = o + 1
	if o == num or o == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline().strip('\n'))
	arr = [int(x) for x in stdin.readline().split()]
	parity = arr[0] % 2 == 0
	flag = True
	for i in arr:
		if parity != (i % 2 == 0):
			flag = False
	print('YES' if flag else 'NO')


t = int(input())
for T in range(t):
	n = int(input())
	x = input()
	a = []
	a = x.split(' ')
	for i in range(len(a)):
		a[i] = int(a[i])
	if n == 1:
		print('YES')
	else:
		a.sort()
		flag = False
		m1 = a[0]
		m2 = a[1]
		for i in range(n):
			a[i] = a[i] - m1
			if a[i] % 2 != 0:
				flag = True
				break
		if flag:
			print('NO')
		else:
			print('YES')