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.
[{"code": "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tarr = [int(j) for j in input().split()]\n\tflag = 0\n\tfor x in arr:\n\t\tif x%2 != arr[0]%2:\n\t\t\tflag = 1\n\t\t\tbreak\n\tif flag == 1:\n\t\tprint(\"NO\")\n\telse:\n\t\tprint(\"YES\")", "passed": true, "time": 0.2, "memory": 14292.0, "status": "done"}, {"code": "q = int(input())\nfor rwe in range(q):\n\tn = int(input())\n\tl = list(map(int,input().split()))\n\tdasie = True\n\tfor i in range(1,n):\n\t\tif (l[i]-l[i-1])%2 == 1:\n\t\t\tdasie = False\n\tif dasie:\n\t\tprint(\"YES\")\n\telse:\n\t\tprint(\"NO\")", "passed": true, "time": 1.68, "memory": 14312.0, "status": "done"}, {"code": "for i in range(int(input())):\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\tk1 = 0\n\tk2 = 0\n\tfor i in a:\n\t\tif i % 2 == 0:\n\t\t\tk1 += 1\n\t\telse:\n\t\t\tk2 += 1\n\tif k1 != 0 and k2 != 0:\n\t\tprint('NO')\n\telse:\n\t\tprint('YES')\n", "passed": true, "time": 0.16, "memory": 14248.0, "status": "done"}, {"code": "t = int(input())\nfor i in range(t):\n    n = int(input())\n    data = tuple(map(int, input().split()))\n    f = data[0] % 2\n    for i in data:\n        if i % 2 != f:\n            print(\"NO\")\n            break\n    else:\n        print(\"YES\")\n", "passed": true, "time": 0.15, "memory": 14304.0, "status": "done"}, {"code": "for i in range(int(input())):\n    n = int(input())\n    arr = list(map(int, input().split()))\n    kek = [0, 0]\n    for x in arr:\n        kek[x % 2] += 1\n    print(\"YES\" if kek[0] == 0 or kek[1] == 0 else \"NO\")\n", "passed": true, "time": 0.16, "memory": 14144.0, "status": "done"}, {"code": "def one():\n    return int(input())\n\n\ndef more():\n    return list(map(int, input().split()))\n\n\nfor _ in range(one()):\n    n = one()\n    l = list(more())\n    s = 0\n    for i in l:\n        s += i % 2\n    if s%n==0:\n        print('YES')\n    else:\n        print('NO')\n", "passed": true, "time": 0.27, "memory": 14212.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n = int(input())\n    a = sorted(map(int, input().split()))\n\n    x = a[0] % 2\n\n    if all(i % 2 == x for i in a):\n        print('YES')\n    else:\n        print('NO')", "passed": true, "time": 0.23, "memory": 14080.0, "status": "done"}, {"code": "from sys import stdin,stdout                           #\nimport math                                            #\nimport heapq                                           #\n                                                       #\nt = 1                                                  #\ndef aint():                                            #\n\treturn int(input().strip())                        #\ndef lint():                                            #\n\treturn list(map(int,input().split()))              #\ndef fint():                                            #\n\treturn list(map(int,stdin.readline().split()))     #\n                                                       #\t\n########################################################\n\ndef main():\n\tn=aint()\n\tl=lint()\n\todd=False\n\teven=False\n\tfor i in l:\n\t\tif i%2==1:\n\t\t\todd=True\n\t\telse:\n\t\t\teven=True\n\tif odd and even:\n\t\tprint(\"NO\")\n\telse:\n\t\tprint(\"YES\")\n\t#solve\n\nt=int(input())\n\n########################################################\nfor i in range(t):                                     #\n\tmain()                                             #", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "import re, math, decimal, bisect\ndef read(): return input().strip()\ndef iread(): return int(input().strip())\ndef viread(): return [int(_) for _ in input().strip().split()]\ndef round(n): return int(n + 0.5)\n\nDEBUG = 1\n# DEBUG = 0\ndef debug(*args, **kwargs):\n    if DEBUG: print(*args, **kwargs)\n    \n# code goes here\nt = iread()\nfor _ in range(t):\n    n = iread()\n    arr = viread()\n    can = True\n    for i in range(n-1):\n        if (arr[i] - arr[i+1]) % 2 == 1:\n            can = False\n            break\n    print([\"NO\", \"YES\"][int(can)])\n", "passed": true, "time": 0.23, "memory": 14272.0, "status": "done"}, {"code": "# HEY STALKER\nfor _ in range(int(input())):\n    n = int(input())\n    l = list(map(int, input().split()))\n    e = 0\n    o = 0\n    for t in l:\n        if t % 2:\n            o += 1\n        else:\n            e += 1\n    if not e or not o:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.24, "memory": 14216.0, "status": "done"}, {"code": "def solve(n, a):\n    mn = min(a)\n    a = [i-mn for i in a]\n    for i in a:\n        if i%2:\n            return \"NO\"\n    return \"YES\"\n\n\ndef main():\n    t = int(input())\n    for _ in range(t):\n        n = int(input())\n        a = [int(i) for i in input().split()]\n        print(solve(n, a))\n\n\nmain()\n", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "\nt = int(input())\n\nfor loop in range(t):\n\n    n = int(input())\n\n    a = list(map(int,input().split()))\n\n    ans = \"YES\"\n    for i in range(n-1):\n\n        if a[-1] % 2 != a[i] % 2:\n            ans = \"NO\"\n\n    print (ans)\n", "passed": true, "time": 0.23, "memory": 14064.0, "status": "done"}, {"code": "def main():\n    import sys\n    input = sys.stdin.readline\n\n    for _ in range(int(input())):\n        N = int(input())\n        A = list(map(int, input().split()))\n        flg = A[0] & 1\n        ok = 1\n        for a in A:\n            if a&1 != flg:\n                ok = 0\n        if ok:\n            print('YES')\n        else:\n            print('NO')\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14220.0, "status": "done"}, {"code": "T = int(input())\n\nfor _ in range(T):\n    N = int(input())\n    L = list(map(int, input().split()))\n    if all(l % 2 == L[0] % 2 for l in L):\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "t = int(input())\n\nfor _ in range(t):\n\tn = int(input())\n\theights = list(map(int, input().split()))\n\n\ts = set()\n\n\tfor i in heights:\n\t\ts.add(i % 2)\n\n\t\tif len(s) == 2:\n\t\t\tbreak\n\n\tif len(s) == 1:\n\t\tprint('YES')\n\telse:\n\t\tprint('NO')", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "t = int(input())\nfor case in range(t):\n    n = int(input())\n    arr = list(map(int, input().split()))\n    n_odd = 0\n    n_even = 0\n    for i in arr:\n        if i % 2 == 0:\n            n_even += 1\n        else:\n            n_odd += 1\n    if n_even and n_odd:\n        print(\"NO\")\n    else:\n        print(\"YES\")", "passed": true, "time": 0.23, "memory": 14116.0, "status": "done"}, {"code": "\n\nfor _ in range(int(input())):\n\tn=int(input())\n\ta=list(map(int,input().split()))\n\n\tf=0\n\n\tfor i in range(n):\n\t\tfor j in range(i+1,n):\n\t\t\tif(abs(a[i]-a[j])&1):\n\t\t\t\tf=1\n\tif(f):\n\t\tprint(\"NO\")\n\telse:\n\t\tprint(\"YES\")", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    N=int(input())\n    L=list(map(int,input().split()))\n    V=[0,0]\n    for i in L:\n        V[i%2]+=1\n    if V[0]==0 or V[1]==0:\n        print('YES')\n    else:\n        print('NO')", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "import math,sys\nfrom collections import Counter, defaultdict, deque\nfrom sys import stdin, stdout\ninput = stdin.readline\nli = lambda:list(map(int,input().split()))\n\ndef case():\n    n=int(input())\n    a=li()\n    c=0\n    for i in a:\n        if(i%2==0):\n            c+=1\n    if(c==0 or c==n):\n        print(\"YES\")\n    else:\n        print(\"NO\")\n\nfor _ in range(int(input())):\n    case()", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "t = int(input())\nwhile(t):\n    t -= 1\n    n = int(input())\n    a = list(map(int, input().split()))\n    rems = set()\n    for i in a:\n        rems.add(i%2)\n    if(len(rems) == 1):\n        print(\"YES\")\n    else:\n        print(\"NO\")", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    n = int(input())\n    arr = list(map(int, input().split()))\n    odd = 0\n    even = 0\n    for i in arr:\n        if i%2==0:\n            even += 1\n        else:\n            odd+=1\n    if odd==0 or even==0:\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\n\nfor _ in range(int(input())):\n    n = int(input())\n    x = [*map(int, input().split())]\n    p = x.pop()\n    print(\"YES\" if all((p-i) % 2 == 0 for i in x) else \"NO\")", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "from bisect import bisect_left, bisect_right\n\n\ndef go():\n    n = int(input())\n    a = list(map(int, input().split()))\n    ma = min(a)\n    return 'YES' if all((aa-ma)%2==0 for aa in a ) else 'NO'\n\nt = int(input())\nfor _ in range(t):\n    print(go())\n", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "t = int(input())\nfor i in range(t):\n    n = int(input())\n    s = 0\n    arr = list(map(int, input().split()))\n    mn = min(arr)\n    for el in arr:\n        s += (el - mn) % 2\n    if s == 0:\n        print(\"YES\")\n    else:\n        print(\"NO\")", "passed": true, "time": 0.14, "memory": 14176.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    N =int(input())\n    X = list(map(int, input().split()))\n    Max = max(X)\n    Check = True\n    for i in X:\n        if (Max - i) %2!= 0:\n            Check = False\n            break\n    print(\"YES\" if Check else \"NO\")", "passed": true, "time": 0.14, "memory": 14152.0, "status": "done"}, {"code": "import math\n \n \nclass Read:\n    @staticmethod\n    def string():\n        return input()\n \n    @staticmethod\n    def int():\n        return int(input())\n \n    @staticmethod\n    def list(sep=' '):\n        return input().split(sep)\n \n    @staticmethod\n    def list_int(sep=' '):\n        return list(map(int, input().split(sep)))\n \nresult = math.inf\n \ndef solve():\n  n = Read.int()\n  a = Read.list_int();\n  t = 0\n  for i in a:\n    if i % 2 == 0:\n      t += 1\n  print('YES' if t == 0 or t == n else 'NO')\n \n# query_count = 1\nquery_count = Read.int()\nwhile query_count:\n    query_count -= 1\n    solve()", "passed": true, "time": 0.14, "memory": 14348.0, "status": "done"}, {"code": "t = int(input())\nfor _ in range(t):\n    n = int(input())\n    a = list(map(int, input().split()))\n    c = [i%2 for i in a]\n    if sum(c) == 0 or sum(c) == n:\n        print('YES')\n    else:\n        print('NO')", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "qq = int(input())\nfor _ in range(qq):\n    n = int(input())\n    dat = list(map(int, input().split()))\n    if n == 1:\n        print(\"YES\")\n        continue\n    c = dat[0] % 2\n    f = True\n    for i in range(n):\n        if c != dat[i] % 2:\n            f = False\n    print(\"YES\" if f else \"NO\")\n", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}]