import java.util.Scanner;
public class Codeforce_1324A {
    public static void main(String[] args) {

        int number;
        long a;
        long b;
        long[] c = new long[100];

        Scanner in = new Scanner(System.in);
        number = in.nextInt();

        for(int i = 0;i<number;i++){
            a = in.nextLong();
            for (int j =0;j<a;j++){
                b = in.nextLong();
                c[j] = b;
                if(c[j]%2==0&&c[j+1]%2==0){
                    System.out.println("yes");
                }
                else if(c[j]%2==1&&c[j+1]%2==1){
                    System.out.println("yes");
                }
                else{
                    System.out.println("no");
                }
            }
        }
    }
}


import java.util.Scanner;
public class Codeforce_1324A {
    public static void main(String[] args) {

        int number;
        long a;
        long b;
        long c =0;

        Scanner in = new Scanner(System.in);
        number = in.nextInt();

        for(int i = 0;i<number;i++){
            a = in.nextLong();
            for (int j =0;j<a;j++){
                b = in.nextLong();
                if(b%2==0) {
                    c++;
                }
        }
            if(c==a||c==0){
                System.out.println("yes");
            }
            else{
                System.out.println("no");
            }
    }
}


import java.util.Scanner;
public class Codeforce_1324A {
    public static void main(String[] args) {

        int number;
        long a;
        long b;

        Scanner in = new Scanner(System.in);
        number = in.nextInt();

        for (int i = 0; i < number; i++) {
            a = in.nextLong();
            long c = 0;
            for (int j = 0; j < a; j++) {
                b = in.nextLong();
                if (b % 2 == 0) {
                    c++;
                }
            }
            if (c == a || c == 0) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
    }
}


import java.io.*;
import java.util.*;
public class T {
    public static void main(String[] args) throws IOException {
     Scanner sc=new Scanner(System.in);
     int loop=sc.nextInt();

    while(loop-->0){
      int inloop=sc.nextInt();
      ArrayList<Integer> a =new ArrayList<Integer>();
      int max=0;
      while(inloop-->0){
        int temp = sc.nextInt();
        a.add(temp);
        max=Math.max(temp,max);
      }
      String ans = "YES";
      for(Integer i:a)if((max-i)%2!=0){ans="NO";break;}
        System.out.println(ans);
    }

    }
}


import java.io.*;
import java.util.*;

public class T {
    public static void main(String[] args) throws IOException {
     Scanner sc=new Scanner(System.in);
     int loop=sc.nextInt();

     while(loop-->0){
     int loops=sc.nextInt();
ArrayList<Integer> a=new ArrayList<Integer>();     int max=0;
     while(loops-->0){
int x=sc.nextInt();
      a.add(x);
      max=Math.max(max,x);}
      String xa="YES";
for(Integer i: a)if((max-i)%2!=0){xa="NO";break;}
  System.out.println(xa);
    }

    }
}


import java.util.*;
public class JavaApplication98 {

    /**
     * @param args the command line argumen
     * ts
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc= new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int n=sc.nextInt();
            int a[]=new int[n];
            boolean flag=true;
            a[0]=sc.nextInt();
            for(int i=1;i<n;i++)
            {
                a[i]=sc.nextInt();
                int temp=Math.abs(a[i]-a[i-1]);
                if(temp%2!=0)
                {
                    flag=false;
                }

            }
            if(flag==false)
                System.out.println("NO");
                else
                System.out.println("YES");
        }

    }

}


import java.util.*;
public class JavaApplication98 {

    /**
     * @param args the command line argumen
     * ts
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc= new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int n=sc.nextInt();
            int a[]=new int[n];
            boolean flag=true;
            a[0]=sc.nextInt();
            for(int i=1;i<n;i++)
            {
                a[i]=sc.nextInt();
                int temp=Math.abs(a[i]-a[i-1]);
                if(temp!=0 && temp!=2)
                {
                    flag=false;
                }

            }
            if(flag==false)
                System.out.println("NO");
                else
                System.out.println("YES");
        }

    }

}


import java.util.*;
public class JavaApplication98 {

    /**
     * @param args the command line argumen
     * ts
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc= new Scanner(System.in);
        int t=sc.nextInt();
        while(t--!=0)
        {
            int n=sc.nextInt();
            int a[]=new int[n];
            boolean flag=true;
            a[0]=sc.nextInt();
            for(int i=1;i<n;i++)
            {
                a[i]=sc.nextInt();
                int temp=Math.abs(a[i]-a[i-1]);
                if(temp!=0 && temp!=2)
                {
                    flag=false;
                }

            }
            if(flag==false)
                System.out.println("NO);
                else
                System.out.println("YES");
        }

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public static void solve(int testNumber, FastReader in, PrintWriter out) {
           int t=in.nextInt();
           while(t-->0){
               int n=in.nextInt();
               int[] a=in.readIntArray(n);
               for(int i=0;i<n;++i){
                   if(a[i]%2==0) f++;
               }
               if(n==1) out.println("YES");
               else if(f==0) out.println("YES");
               else if(f%2==0) out.println("YES");
               else out.println("NO");

           }

        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public static void solve(int testNumber, FastReader in, PrintWriter out) {
           int t=in.nextInt();
           while(t-->0){
               int f=0;
               int n=in.nextInt();
               int[] a=in.readIntArray(n);
               for(int i=0;i<n;++i){
                   if(a[i]%2==0) f++;
               }
               if(n==1) out.println("YES");
               else if(f==0) out.println("YES");
               else if(f%2==0) out.println("YES");
               else out.println("NO");

           }

        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public static void solve(int testNumber, FastReader in, PrintWriter out) {
           int t=in.nextInt();
           while(t-->0){
               int f=0;
               int n=in.nextInt();
               int[] a=in.readIntArray(n);
               Arrays.sort(a);
               for(int i=0;i<n-1;++i){
                   if((a[i+1]-a[i])%2!=0){
                     f++;
                     break;
                   }
               }
               if(f==0) out.println("YES");
               else out.println("NO");

           }

        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public static void solve(int testNumber, FastReader in, PrintWriter out) {
           int t=in.nextInt();
           while(t-->0){
               int f=0;
               int n=in.nextInt();
               int[] a=in.readIntArray(n);
               for(int i=0;i<n;++i){
                   if(a[i]%2==0) f++;
               }
               if(n==1) out.println("YES");
               else if(f==0) out.println("YES");
               //else if(f%2==0) out.println("YES");
               else out.println("NO");

           }

        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

    }
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;

public class A {
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		InputReader s = new InputReader(System.in);
		PrintWriter p = new PrintWriter(System.out);
		int t = s.nextInt();
		while (t-- > 0) {
			int n = s.nextInt();
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = s.nextInt();
			}
			int flag = 0;
			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					int diff = arr[i] - arr[j];
					if (diff % 2 == 1) {
						flag = 1;
					}
				}
			}
			if (flag == 0)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		p.flush();
		p.close();
	}

	public static boolean prime(long n) {
		if (n == 1) {
			return false;
		}
		if (n == 2) {
			return true;
		}
		for (long i = 2; i <= (long) Math.sqrt(n); i++) {
			if (n % i == 0)
				return false;
		}
		return true;
	}

	public static ArrayList Divisors(long n) {
		ArrayList<Long> div = new ArrayList<>();

		for (long i = 1; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				div.add(i);

				if (n / i != i)
					div.add(n / i);
			}
		}
		return div;
	}

	public static int BinarySearch(long[] a, long k) {
		int n = a.length;
		int i = 0, j = n - 1;
		int mid = 0;

		if (k < a[0])
			return 0;
		else if (k >= a[n - 1])
			return n;
		else {
			while (j - i > 1) {
				mid = (i + j) / 2;

				if (k >= a[mid])
					i = mid;
				else
					j = mid;
			}
		}

		return i + 1;
	}

	public static long GCD(long a, long b) {
		if (b == 0)
			return a;
		else
			return GCD(b, a % b);
	}

	public static long LCM(long a, long b) {
		return (a * b) / GCD(a, b);
	}

	static class pair implements Comparable<pair> {
		Integer x, y;

		pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if (result == 0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString() {
			return x + " " + y;
		}

		public boolean equals(Object o) {
			if (o instanceof pair) {
				pair p = (pair) o;
				return p.x - x == 0 && p.y - y == 0;
			}
			return false;
		}

		public int hashCode() {
			return new Long(x).hashCode() * 31 + new Long(y).hashCode();
		}
	}

	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class CodeX {
		public static void sort(long arr[]) {
			merge_sort(arr, 0, arr.length - 1);
		}

		private static void merge_sort(long A[], long start, long end) {
			if (start < end) {
				long mid = (start + end) / 2;
				merge_sort(A, start, mid);
				merge_sort(A, mid + 1, end);
				merge(A, start, mid, end);
			}

		}

		private static void merge(long A[], long start, long mid, long end) {
			long p = start, q = mid + 1;
			long Arr[] = new long[(int) (end - start + 1)];
			long k = 0;

			for (int i = (int) start; i <= end; i++) {
				if (p > mid)
					Arr[(int) k++] = A[(int) q++];

				else if (q > end)
					Arr[(int) k++] = A[(int) p++];

				else if (A[(int) p] < A[(int) q])
					Arr[(int) k++] = A[(int) p++];

				else
					Arr[(int) k++] = A[(int) q++];
			}
			for (int i = 0; i < k; i++) {
				A[(int) start++] = Arr[i];
			}

		}

	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		InputReader s = new InputReader(System.in);
		PrintWriter p = new PrintWriter(System.out);
		int t = s.nextInt();
		while (t-- > 0) {
			int n = s.nextInt();
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = s.nextInt();
			}
			Arrays.sort(arr);
			int flag = 0;
			for (int i = 0; i < n-1; i++) {
				int diff = arr[i+1]-arr[i];
				if(diff%2==1 || diff%2==-1) {
					flag = 1;
					break;
				}
			}
			if (flag == 0)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		p.flush();
		p.close();
	}

	public static boolean prime(long n) {
		if (n == 1) {
			return false;
		}
		if (n == 2) {
			return true;
		}
		for (long i = 2; i <= (long) Math.sqrt(n); i++) {
			if (n % i == 0)
				return false;
		}
		return true;
	}

	public static ArrayList Divisors(long n) {
		ArrayList<Long> div = new ArrayList<>();

		for (long i = 1; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				div.add(i);

				if (n / i != i)
					div.add(n / i);
			}
		}
		return div;
	}

	public static int BinarySearch(long[] a, long k) {
		int n = a.length;
		int i = 0, j = n - 1;
		int mid = 0;

		if (k < a[0])
			return 0;
		else if (k >= a[n - 1])
			return n;
		else {
			while (j - i > 1) {
				mid = (i + j) / 2;

				if (k >= a[mid])
					i = mid;
				else
					j = mid;
			}
		}

		return i + 1;
	}

	public static long GCD(long a, long b) {
		if (b == 0)
			return a;
		else
			return GCD(b, a % b);
	}

	public static long LCM(long a, long b) {
		return (a * b) / GCD(a, b);
	}

	static class pair implements Comparable<pair> {
		Integer x, y;

		pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if (result == 0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString() {
			return x + " " + y;
		}

		public boolean equals(Object o) {
			if (o instanceof pair) {
				pair p = (pair) o;
				return p.x - x == 0 && p.y - y == 0;
			}
			return false;
		}

		public int hashCode() {
			return new Long(x).hashCode() * 31 + new Long(y).hashCode();
		}
	}

	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class CodeX {
		public static void sort(long arr[]) {
			merge_sort(arr, 0, arr.length - 1);
		}

		private static void merge_sort(long A[], long start, long end) {
			if (start < end) {
				long mid = (start + end) / 2;
				merge_sort(A, start, mid);
				merge_sort(A, mid + 1, end);
				merge(A, start, mid, end);
			}

		}

		private static void merge(long A[], long start, long mid, long end) {
			long p = start, q = mid + 1;
			long Arr[] = new long[(int) (end - start + 1)];
			long k = 0;

			for (int i = (int) start; i <= end; i++) {
				if (p > mid)
					Arr[(int) k++] = A[(int) q++];

				else if (q > end)
					Arr[(int) k++] = A[(int) p++];

				else if (A[(int) p] < A[(int) q])
					Arr[(int) k++] = A[(int) p++];

				else
					Arr[(int) k++] = A[(int) q++];
			}
			for (int i = 0; i < k; i++) {
				A[(int) start++] = Arr[i];
			}

		}

	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		InputReader s = new InputReader(System.in);
		PrintWriter p = new PrintWriter(System.out);
		int t = s.nextInt();
		while (t-- > 0) {
			int n = s.nextInt();
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = s.nextInt();
			}
			Arrays.sort(arr);
			int flag = 0;
			for (int i = 0; i < n-1; i++) {
				int diff = arr[i+1]-arr[i];
				if(diff%2==1) {
					flag = 1;
					break;
				}
			}
			if (flag == 0)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		p.flush();
		p.close();
	}

	public static boolean prime(long n) {
		if (n == 1) {
			return false;
		}
		if (n == 2) {
			return true;
		}
		for (long i = 2; i <= (long) Math.sqrt(n); i++) {
			if (n % i == 0)
				return false;
		}
		return true;
	}

	public static ArrayList Divisors(long n) {
		ArrayList<Long> div = new ArrayList<>();

		for (long i = 1; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				div.add(i);

				if (n / i != i)
					div.add(n / i);
			}
		}
		return div;
	}

	public static int BinarySearch(long[] a, long k) {
		int n = a.length;
		int i = 0, j = n - 1;
		int mid = 0;

		if (k < a[0])
			return 0;
		else if (k >= a[n - 1])
			return n;
		else {
			while (j - i > 1) {
				mid = (i + j) / 2;

				if (k >= a[mid])
					i = mid;
				else
					j = mid;
			}
		}

		return i + 1;
	}

	public static long GCD(long a, long b) {
		if (b == 0)
			return a;
		else
			return GCD(b, a % b);
	}

	public static long LCM(long a, long b) {
		return (a * b) / GCD(a, b);
	}

	static class pair implements Comparable<pair> {
		Integer x, y;

		pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if (result == 0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString() {
			return x + " " + y;
		}

		public boolean equals(Object o) {
			if (o instanceof pair) {
				pair p = (pair) o;
				return p.x - x == 0 && p.y - y == 0;
			}
			return false;
		}

		public int hashCode() {
			return new Long(x).hashCode() * 31 + new Long(y).hashCode();
		}
	}

	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class CodeX {
		public static void sort(long arr[]) {
			merge_sort(arr, 0, arr.length - 1);
		}

		private static void merge_sort(long A[], long start, long end) {
			if (start < end) {
				long mid = (start + end) / 2;
				merge_sort(A, start, mid);
				merge_sort(A, mid + 1, end);
				merge(A, start, mid, end);
			}

		}

		private static void merge(long A[], long start, long mid, long end) {
			long p = start, q = mid + 1;
			long Arr[] = new long[(int) (end - start + 1)];
			long k = 0;

			for (int i = (int) start; i <= end; i++) {
				if (p > mid)
					Arr[(int) k++] = A[(int) q++];

				else if (q > end)
					Arr[(int) k++] = A[(int) p++];

				else if (A[(int) p] < A[(int) q])
					Arr[(int) k++] = A[(int) p++];

				else
					Arr[(int) k++] = A[(int) q++];
			}
			for (int i = 0; i < k; i++) {
				A[(int) start++] = Arr[i];
			}

		}

	}

}


import java.util.*;
import java.io.*;

public class Main{
    public static void main(String args[]) throws IOException{
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        int test = Integer.parseInt(bf.readLine());

        while(test-->0)
        {
            String str[] = bf.readLine().split(" ");

            int A[] =new int[str.length];

            for(int i=0; i<str.length; i++)
            A[i] = Integer.parseInt(str[i]);

            int count[] = new int[2];
            count[0] = 0;
            count[1] = 0;

            for(int i=0; i<str.length; i++)
            {
                count[A[i]%2]++;
            }

            if(count[0]>0 && count[1]>0)
            System.out.println("NO");
            else
            System.out.println("YES");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution{
    public static void main(String args[]) throws IOException{
        BufferReader bf = new BufferedReader(new InputStreamReader(System.in));

        int test = Integer.parseInt(bf.readLine());

        while(test-->0)
        {
            String str[] = bf.readLine().split(" ");

            int A[] =new int[str.length];

            for(int i=0; i<str.length; i++)
            A[i] = Integer.parseInt(str[i]);

            int count[] = new int[2];

            for(int i=0; i<str.length; i++)
            {
                count[A[i]%2]++;
            }

            if(count[0] && count[1])
            System.out.println("NO");
            else
            System.out.println("Yes");
        }
    }
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String args[]) throws IOException{
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        int test = Integer.parseInt(bf.readLine());

        while(test-->0)
        {
            int n = Integer.parseInt(bf.readLine());
            String str[] = bf.readLine().split(" ");

            int A[] =new int[str.length];

            for(int i=0; i<str.length; i++)
            A[i] = Integer.parseInt(str[i]);

            int count[] = new int[2];
            count[0] = 0;
            count[1] = 0;

            for(int i=0; i<str.length; i++)
            {

                count[A[i]%2]++;

                //System.out.print(A[i]+" ");
            }
            //System.out.println();

           // System.out.print(count[0] +" "+ count[1]);

            if((count[0]>0 && count[1]>0))
            System.out.println("NO");
            else
            System.out.println("Yes");
        }
    }
}


import java.util.*;
import java.io.*;

public class Solution{
    public static void main(String args[]){
        BufferReader bf = new BufferedReader(new InputStreamReader(System.in));

        int test = Integer.parseInt(bf.readLine());

        while(test-->0)
        {
            String str[] = bf.readLine().split(" ");

            int A[] =new int[str.length];

            for(int i=0; i<str.length; i++)
            A[i] = Integer.parseInt(str[i]);

            int count[] = new int[2];

            for(int i=0; i<str.length; i++)
            {
                count[A[i]%2]++;
            }

            if(count[0] && count[1])
            System.out.println("NO");
            else
            System.out.println("Yes");
        }
    }
}


import java.util.*;
import java.io.*;

public class Main{
    public static void main(String args[]) throws IOException{
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        int test = Integer.parseInt(bf.readLine());

        while(test-->0)
        {
            String str[] = bf.readLine().split(" ");

            int A[] =new int[str.length];

            for(int i=0; i<str.length; i++)
            A[i] = Integer.parseInt(str[i]);

            int count[] = new int[2];
            count[0] = 0;
            count[1] = 0;

            for(int i=0; i<str.length; i++)
            {
                count[A[i]%2]++;
            }

            if((count[0]>0 && count[1]>0))
            System.out.println("NO");
            else
            System.out.println("Yes");
        }
    }
}


package javaapplication30;

import java.util.Scanner;

public class JavaApplication30 {
    public static void main(String[] args) {
        int n, tr, ost = 0, pom;
        boolean yes;
        Scanner s = new Scanner(System.in);
        n = s.nextInt();

        for(int i = 0; i < n; i ++) {
            tr = s.nextInt();
            yes = true;
            for(int j = 0; j < tr; j ++) {
                pom = s.nextInt();
                if(j == 0) ost = pom % 2;
                else if(pom % 2 != ost)
                    yes = false;
            }
            System.out.println(yes ? "YES" : "NO");
        }
    }
}


import java.util.Scanner;

public class Klasa {
    public static void main(String[] args) {
        int n, tr, ost = 0, pom;
        boolean yes;
        Scanner s = new Scanner(System.in);
        n = s.nextInt();

        for(int i = 0; i < n; i ++) {
            tr = s.nextInt();
            yes = true;
            for(int j = 0; j < tr; j ++) {
                pom = s.nextInt();
                if(j == 0) ost = pom % 2;
                else if(pom % 2 != ost)
                    yes = false;
            }
            System.out.println(yes ? "YES" : "NO");
        }
    }
}


public class Klasa {

    public static void main(String[] args) {
        int n, tr, ost = 0, pom;
        boolean yes;
        Scanner s = new Scanner(System.in);
        n = s.nextInt();

        for(int i = 0; i < n; i ++) {
            tr = s.nextInt();
            yes = true;
            for(int j = 0; j < tr; j ++) {
                pom = s.nextInt();
                if(j == 0) ost = pom % 2;
                else if(pom % 2 != ost)
                    yes = false;
            }
            System.out.println(yes ? "YES" : "NO");
        }
    }

}


 import java.util.*;
 import java.lang.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");
 				break;
 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<a.length-1;i++)
 				{
 					if(Math.abs(a[i]-a[i+1])%2!=0){
 						flag=0;
 						break;
 					}
 				}

 				if(flag==0)
 					System.out.println("NO");

 				else
 					System.out.println("YES");
 			}
 		}
 	}
 }


 import java.util.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");
 				break;
 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<n-1;i++)
 				{
 					if((a[i]-a[i+1])%2!=0)
 					{
 						System.out.println("NO");
 						flag=1;
 						break;
 					}
 				}
 					if(flag==-1){

 						System.out.println("YES");

 					}
 			}
 		}
 	}
 }


 import java.util.*;
 import java.lang.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");
 				break;
 			}
 			else
 			{
 				// int flag=-1;
 				// for(int i=0;i<n-1;i++)
 				// {
 				// 	if(Math.abs((a[i]-a[i+1]))%2!=0)
 				// 	{
 				// 		System.out.println("NO");
 				// 		flag=1;
 				// 		break;
 				// 	}
 				// }
 				// 	if(flag==-1){

 				// 		System.out.println("YES");}

 				Arrays.sort(a);

 				if((a[n-2]-a[n-1])%2!=0)
 				{
 					System.out.println("NO");
 				}
 				else
 				{
 					// while(a[n-1]!=0){
 					// a[0]+=2;
 					// Arrays.sort(a);
 					// for(int i=0;i<n;i++)
 					// {
 					// 	a[i]-=a[0];
 					// }}
 					System.out.println("YES");
 				}
 			}
 		}
 	}
 }


 import java.util.*;
 import java.lang.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");
 				break;
 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<n-1;i++)
 				{
 					if(Math.abs((a[i]-a[i+1]))%2!=0)
 					{
 						System.out.println("NO");
 						flag=1;
 						break;
 					}
 				}
 					if(flag==-1){

 						System.out.println("YES");}

 				// Arrays.sort(a);
 				// a[0]+=2;
 				// Arrays.sort(a);
 				// if((a[n-2]-a[n-1])%2!=0)
 				// {

 				// }
 			}
 		}
 	}
 }


 import java.util.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");
 				break;
 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<n-1;i++)
 				{
 					if((a[i]-a[i+1])%2!=0)
 					{
 						System.out.println("NO");
 						flag=1;
 						break;
 					}
 				}
 					if(flag==-1){

 						System.out.println("YES");}
 			}
 		}
 	}
 }


 import java.util.*;
 import java.lang.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");
 				break;
 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<a.length-1;i++)
 				{
 					if(Math.abs(a[i]-a[i+1])%2!=0)
 					{
 						flag=0;
 						break;
 					}
 				}

 				if(flag==0)
 					System.out.println("NO");

 				else
 					System.out.println("YES");
 			}
 		}
 	}
 }


 import java.util.*;
 import java.lang.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES" + p);
 				break;
 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<a.length-1;i++)
 				{
 					if(Math.abs(a[i]-a[i+1])%2!=0){
 						flag=0;
 						break;
 					}
 				}

 				if(flag==0)
 					System.out.println("NO" + p);

 				else
 					System.out.println("YES" + p);
 			}
 		}
 	}
 }


 import java.util.*;
 import java.lang.*;

 public class solution{
 	public static void main(String args[])
 	{
 		Scanner s=new Scanner(System.in);
 		int t=s.nextInt();
 		for(int p=0;p<t;p++)
 		{
 			int n=s.nextInt();
 			int[] a=new int[n];
 			for(int i=0;i<n;i++)
 			{
 				a[i]=s.nextInt();
 			}
 			if(n==1)
 			{
 				System.out.println("YES");

 			}
 			else
 			{
 				int flag=-1;
 				for(int i=0;i<a.length-1;i++)
 				{
 					if(Math.abs(a[i]-a[i+1])%2!=0){
 						flag=0;
 						break;
 					}
 				}

 				if(flag==0)
 					System.out.println("NO");

 				else
 					System.out.println("YES");
 			}
 		}
 	}
 }


import java.util.*;
public class Solution
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int n=scan.nextInt();
            int arr[]=new int[n];
            for(int i=0;i<n;i++)
                arr[i]=scan.nextInt();
            Arrays.sort(arr);
            boolean check=false;
            for(int i=0;i<n;i++)
            {
                if((arr[i]-arr[i-1])%2!=0)
                {
                    check=true;
                    break;
                }
            }
            if(check)
                System.out.println("NO");
            else
                System.out.println("YES");
        }
    }
}


import java.util.*;
public class Solution
{
    public static void main(String ar[])
    {
        Scanner scan=new Scanner(System.in);
        int test=scan.nextInt();
        while(test-->0)
        {
            int n=scan.nextInt();
            int arr[]=new int[n];
            for(int i=0;i<n;i++)
                arr[i]=scan.nextInt();
            Arrays.sort(arr);
            boolean check=false;
            for(int i=1;i<n;i++)
            {
                if((arr[i]-arr[i-1])%2!=0)
                {
                    check=true;
                    break;
                }
            }
            if(check)
                System.out.println("NO");
            else
                System.out.println("YES");
        }
    }
}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.math.*;

public class A {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int t = scan.nextInt();
    	for(int tt=0; tt<t; tt++) {
    		int n = scan.nextInt();
    		int [] arr = scan.readArray(n);
    		boolean works = true;
    		int mod = arr[0] % 2;
    		for(int i=0; i<n; i++) {
    			if(arr[i] % 2 != mod) works = false;
    		}
    		System.out.println(works ? "Yes" : "No");
     	}

    }

    public static void sort(int [] a) {
    	ArrayList<Integer> b = new ArrayList<>();
    	for(int i: a) b.add(i);
    	Collections.sort(b);
    	for(int i=0; i<a.length; i++) a[i]= b.get(i);
    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

    	int nextInt() {
    		return Integer.parseInt(next());
    	}

    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}

    	long nextLong() {
    		return Long.parseLong(next());
    	}

    }

}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class A {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int t = scan.nextInt();
    		for(int tt=0; tt<t; tt++) {
    			int n = scan.nextInt();
    			int [] arr = scan.readArray(n);
    			sort(arr);
    			boolean works = true;
    			for(int i=0; i+1<n; i++) {
    				if((arr[i+1] - arr[i]) % 2 != 0) works = false;
    			}
    			System.out.println(works ? "Yes" : "No");
     		}
    }

    public static void sort(int [] a) {
    	ArrayList<Integer> b = new ArrayList<>();
    	for(int i: a) b.add(i);
    	Collections.sort(b);
    	for(int i=0; i<a.length; i++) a[i]= b.get(i);
    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

    	int nextInt() {
    		return Integer.parseInt(next());
    	}

    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}

    	long nextLong() {
    		return Long.parseLong(next());
    	}

    }

}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class D {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int n = scan.nextInt();
    	int [] a = scan.readArray(n), b = scan.readArray(n);
    	int [] arr = new int[n];
    	for(int i=0; i<n; i++) {
    		arr[i] = a[i] - b[i];
    	}
    	sort(arr);
    	long count = 0;

    	//binary search
    	for(int i=0; i<n; i++) {
    		int x = -arr[i];
    		int start = i+1, end = n-1;
    		while(start < end) {
    			int mid = (start + end)/2;
    			if(arr[mid] < x) start = mid+1;
    			else end = mid;
    		}
    		if(arr[i] >= arr[n-1]) count+=0;
    		else  count += (n - start);
    	}

    	System.out.println(count);
    }

    public static void sort(int [] a) {
    	ArrayList<Integer> b = new ArrayList<>();
    	for(int i: a) b.add(i);
    	Collections.sort(b);
    	for(int i=0; i<a.length; i++) a[i]= b.get(i);
    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

    	int nextInt() {
    		return Integer.parseInt(next());
    	}

    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}

    	long nextLong() {
    		return Long.parseLong(next());
    	}

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		int numTests = Integer.parseInt(br.readLine());
		int columns;
		int mod2;
		Tests:
		for (int i = 0; i<numTests; i++) {
			columns = Integer.parseInt(br.readLine());
			st = new StringTokenizer(br.readLine());
			mod2 = Integer.parseInt(st.nextToken()) % 2;
			for (int j = 1; j<columns; j++) {
				if (mod2 != Integer.parseInt(st.nextToken()) % 2) {
					System.out.println("NO");
					continue Tests;
				}
			}
			System.out.println("YES");
		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class sol
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0)
		{
		    int n = sc.nextInt();
		    int a[] = new int[n];
		    int h[] = new int[2];
		    for(int i=0;i<n;i++)
		    {
		        a[i] = sc.nextInt();
		        h[a[i]%2]++;
		    }
		    if(h[0] != 0 && h[1] != 0)
		    System.out.println("NO");
		    else
		    System.out.println("YES");
		}
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class sol
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0)
		{
		    int n = sc.nextInt();
		    int a[] = new int[n];
		    int h[] = new int[2];
		    for(int i=0;i<n;i++)
		    {
		        a[i] = sc.nextInt();
		        h[a[i]%2]++;
		    }
		    if(h[0] && h[1])
		    System.out.println("NO");
		    else
		    System.out.println("YES");
		}
    }
}


import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while(t-->0)
		{
			int n = scan.nextInt(),m = 2000,M=-1;
			int a[]= new int[n];
			for(int i=0;i<n;i++)
			{
				int aux = scan.nextInt();
				m = Math.min(m, aux);
				a[i]=aux;
			}
			System.out.println(m);
			boolean b = true;
			for(int i=0;i<n;i++)
			{
				if(a[i]-m%2!=0)b=false;
			}
			if(b)System.out.println("YES");
			else System.out.println("NO");
		}
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while(t-->0)
		{
			int n = scan.nextInt(),m = 2000,M=-1;
			int a[]= new int[n];
			for(int i=0;i<n;i++)
			{
				int aux = scan.nextInt();
				m = Math.min(m, aux);
				a[i]=aux;
			}
			boolean b = true;
			for(int i=0;i<n;i++)
			{
				if((a[i]-m)%2!=0)b=false;
			}
			if(b)System.out.println("YES");
			else System.out.println("NO");
		}
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while(t-->0)
		{
			int n = scan.nextInt(),m = 200,M=-1;
			int a[]= new int[n];
			for(int i=0;i<n;i++)
			{
				int aux = scan.nextInt();
				m = Math.min(m, aux);
				a[i]=aux;
				M=Math.max(aux, M);
			}

			boolean b = true;
			for(int i=0;i<n;i++)
			{
				if(a[i]-m!=0 && a[i]-m!=2)b=false;
			}
			if(b)System.out.println("YES");
			else System.out.println("NO");
		}
	}

}


import java.util.Scanner;
public class Solution{
    public static void main(String args[]){
        int t;
        Scanner in = new Scanner(System.in);
        int i;
        int n;
        t=in.nextInt();
        for(i=0;i<(2*t);i++){
             n=in.nextInt();
             int[] a=new int[100];
             for(int j=0;j<n;j++)
             a[j]=in.nextInt();
             int od=0;
             int ev=0;
             for(j=0;j<n;j++){
                 if(a[j]%2==0)
                 ev++;
                 else
                 od++;
             }
             if(ev==n||od==n)
             System.out.print("YES");
             else
             System.out.print("NO");

        }
    }
}


import java.util.Scanner;
public class Solution{
    public static void main(String args[]){
        int t;
        Scanner in = new Scanner(System.in);
        int i;
        int n;
        t=in.nextInt();
        for(i=0;i<(2*t);i++){
             n=in.nextInt();
             int[] a=new int[100];
             for(int j=0;j<n;j++)
             a[i]=in.nextInt();
             int od=0;
             int ev=0;
             for(i=0;i<n;i++){
                 if(a[i]%2==0)
                 ev++;
                 else
                 od++;
             }
             if(ev==n||od==n)
             System.out.print("YES");
             else
             System.out.print("NO");

        }
    }
}


import java.util.Scanner;
public class Solution{
    public static void main(String args[]){
        int t;
        Scanner in = new Scanner(System.in);
        int i;
        int n;
        t=in.nextInt();
        for(i=0;i<(2*t);i++){
             n=in.nextInt();
             int[] a=new int[100];
             int j;
             for(j=0;j<n;j++)
             a[j]=in.nextInt();
             int od=0;
             int ev=0;
             for(j=0;j<n;j++){
                 if(a[j]%2==0)
                 ev++;
                 else
                 od++;
             }
             if(ev==n||od==n)
             System.out.print("YES");
             else
             System.out.print("NO");

        }
    }
}


import java.util.Scanner;
public class Solution{
    public static void main(String args[]){
        int t;
        Scanner in = new Scanner(System.in);
        int i;
        int n;
        for(i=0;i<(2*t);i++){
             n=in.nextInt();
             int[] a=new int[100];
             for(int j=0;j<n;j++)
             a[i]=in.nextInt();
             int od=0;
             int ev=0;
             for(i=0;i<n;i++){
                 if(a[i]%2==0)
                 ev++;
                 else
                 od++;
             }
             if(ev==n||od==n)
             System.out.print("YES");
             else
             System.out.print("NO");

        }
    }
}


import java.util.Scanner;
public class Solution{
    public static void main(String args[]){
        int t;
        Scanner in = new Scanner(System.in);
        int i;
        int n;
        t=in.nextInt();
        for(i=0;i<(t);i++){
             n=in.nextInt();
             int j;
             int[] a=new int[100];
             for(j=0;j<n;j++)
             a[j]=in.nextInt();
             int od=0;
             int ev=0;
             for(j=0;j<n;j++){
                 if(a[j]%2==0)
                 ev++;
                 else
                 od++;
             }
             if(ev==n||od==n)
             System.out.println("YES");
             else
             System.out.println("NO");

        }
    }
}


import java.util.Scanner;
public class Solution{
    public static void main(String args[]){
        int t;
        Scanner in = new Scanner(System.in);
        int i;
        int n;
        t=in.nextInt();
        for(i=0;i<(t);i++){
             n=in.nextInt();
             int[] a=new int[100];
             for(int j=0;j<n;j++)
             a[j]=in.nextInt();
             int od=0;
             int ev=0;
             for(j=0;j<n;j++){
                 if(a[j]%2==0)
                 ev++;
                 else
                 od++;
             }
             if(ev==n||od==n)
             System.out.println("YES");
             else
             System.out.println("NO");

        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Bartikraw
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int t = in.nextInt();
            for (int i = 0; i < t; i++) {
                String neededValue = "";
                int a = in.nextInt();
                List<Integer> h = new ArrayList<>();
                List<String> values = new ArrayList<>();
                String value = "";
                for (int n = 0; n < a; n++) {
                    h.add(in.nextInt());
                }
                for (int c : h) {
                    neededValue += 0 + " ";
                }
                values.add(neededValue);
                value = "";
                for (int c : h) {
                    value += c + " ";
                }
                while (!values.contains(value)) {
                    // out.println(value);
                    values.add(value);
                    int min = Collections.min(h);
                    if (min != 0) {
                        int ind = 0;
                        for (int c : h) {
                            h.set(ind, c - min);
                            ind++;
                        }
                    }

                    value = "";
                    for (int c : h) {
                        value += c + " ";
                    }

                    h.set(h.indexOf(0), 2);

                }

//            int min = Collections.min(h);
//            if (min != 0){
//                int ind = 0;
//                for (int c: h){
//                    h.set(ind, c - min);
//                    ind ++;
//                }
//            }
//            value ="";
//            for (int c: h){
//                value += c + " ";
//            }
                //out.println("abc "+value);
                if (value.equals(neededValue)) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Bartikraw
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int t = in.nextInt();
            for (int i = 0; i < t; i++) {
                int a = in.nextInt();
                List<Integer> h = new ArrayList<>();
                for (int n = 0; n < a; n++) {
                    h.add(in.nextInt() % 2);
                }

                if (!(h.contains(1) && h.contains(0))) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.util.*;
public class sol{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int tc=sc.nextInt();
        for(int i=0;i<tc;i++){
            int n=sc.nextInt();
            int x=0;
            for(int j=0;j<n;j++){
                int temp=sc.nextInt();
                x+=temp%2;
            }
            if(x==0 || x==n)
            System.out.println("YES");
            else
            System.out.println("NO");
        }
    }
}


import java.utl.*;
public class sol{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int tc=sc.nextInt();
        for(int i=0;i<tc;i++){
            int n=sc.nextInt();
            int x=0;
            for(int j=0;j<n;j++){
                int temp=sc.nextInt();
                x+=temp%2;
            }
            if(x==0 || x==n)
            System.out.println("YES");
            else
            System.out.println("NO");
        }
    }
}


import java.util.*;
public class Tetris {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int i = 0; i < t; i++) {
            int n = in.nextInt();
            int[] field = new int[n];
            for (int N = 0; N < n; N++) {
                field[N] = in.nextInt();
            }
            boolean possible = true;
            for (int j = 0; j < n; j++) {
                if (Math.abs(field[j] - field[0]) % 2 != 0) {
                    possible = false;
                }
            }
            if (possible) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }

    }
}


import java.util.*;
public class Tetris {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int i = 0; i < t; i++) {
            int n = in.nextInt();
            int[] field = new int[n];
            for (int N = 0; N < n; N++) {
                field[N] = in.nextInt();
            }
            boolean possible = true;
            for (int j = 0; j < n; j++) {
                for (int k = j + 1; k < n; k++) {
                    if (Math.abs(field[j] - field[k]) % 2 != 0) {
                        possible = false;
                    }
                }
            }
            if (possible) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }

    }
}


package solutions.java;
import java.util.*;
public class Tetris {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int i = 0; i < t; i++) {
            int n = in.nextInt();
            int[] field = new int[n];
            for (int N = 0; N < n; N++) {
                field[N] = in.nextInt();
            }
            boolean possible = true;
            for (int j = 0; j < n; j++) {
                for (int k = j + 1; k < n; k++) {
                    if (Math.abs(field[j] - field[k]) % 2 != 0) {
                        possible = false;
                    }
                }
            }
            if (possible) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }

    }
}


//make sure to make new file!
import java.io.*;
import java.util.*;

public class A627{

   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);

      int t = Integer.parseInt(f.readLine());

      for(int q = 1; q <= t; q++){

         int n = Integer.parseInt(f.readLine());

         int[] array = new int[n];
         boolean bool = true;
         StringTokenizer st = new StringTokenizer(f.readLine());
         for(int k = 0; k < n; k++){
            array[k] = Integer.parseInt(st.nextToken());
            if(k>0 && array[k]%2 != array[k-1]%2) bool = false;

         }

         if(bool){
            out.println("YES");
         } else {
            out.println("NO");
         }

      }

      out.close();
   }

}


//make sure to make new file!
import java.io.*;
import java.util.*;

public class A627{

   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);

      int t = Integer.parseInt(f.readLine());

      for(int q = 1; q <= t; q++){

         int n = Integer.parseInt(f.readLine());

         int sum = 0;
         StringTokenizer st = new StringTokenizer(f.readLine());
         for(int k = 0; k < n; k++){
            sum += Integer.parseInt(st.nextToken());
         }

         if(sum%2 == n%2 || n==1){
            out.println("YES");
         } else {
            out.println("NO");
         }

      }

      out.close();
   }

}


import java.util.*;

public class Solution{
	public static String result(int arr[],int n){
		int k = arr[0]%2;
		for(int i=1;i<n;i++){
			if(arr[i]%2 != k)
				return "NO";
		}
		return "YES";
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int t= sc.nextInt();
		while(t-- > 0){
			int n= sc.nextInt();
			int arr[] = new int[n];
			for(int i=0;i<n;i++)
				arr[i] = sc.nextInt();
			System.out.print(result(arr,n));
		}
	}
}


import java.util.*;

public class Solution{
	public static String result(int arr[],int n){
		int k = arr[0]%2;
		for(int i=1;i<n;i++){
			if(arr[i]%2 != k)
				return "NO";
		}
		return "YES";
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int t= sc.nextInt();
		while(t-- > 0){
			int n= sc.nextInt();
			int arr[] = new int[n];
			for(int i=0;i<n;i++)
				arr[i] = sc.nextInt();
			System.out.println(result(arr,n));
		}
	}
}


import java.util.*;

public class Solution{
	public static String result(int arr[],int n){
		int k = arr[0]%2;
		for(int i=1;i<n;i++){
			if(arr[i]%2 != k)
				return "NO";
		}
		return "YES";
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int t= sc.nextInt();
		while(t-- > 0){
			int n= sc.nextInt();
			int arr[] = new int[n];
			for(int i=0;i<n;i++)
				arr[i] = sc.nextInt();
			System.out.println(result(arr,n));s
		}
	}
}


//package YetAnotherTetrisProblem;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while (t-- > 0) {
			int n = scan.nextInt();
			int a[] = new int[n];
			int max=0;
			for (int i = 0; i < a.length; i++) {
				a[i] = scan.nextInt();
				if(a[i]>max)max=a[i];
			}
			for (int i = 0; i < a.length; i++) {
				if((max-a[i])%2==0)a[i]=max;
				else a[i]=max-1;
			}
			for (int i = 0; i < a.length-1; i++) {
				if(a[i]<max&&a[i+1]<max) {
					a[i]=a[i+1]=max;
				}
			}
			boolean decide=true;
			for (int i = 0; i < a.length; i++) {
				if(a[i]<max) {
					decide=false;
					break;
				}
			}
			if(decide)System.out.println("YES");
			else System.out.println("NO");

		}
	}
}


//package YetAnotherTetrisProblem;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		while (t-- > 0) {
			int n = scan.nextInt();
			int a[] = new int[n];
			int max=0;
			for (int i = 0; i < a.length; i++) {
				a[i] = scan.nextInt();
				if(a[i]>max)max=a[i];
			}
			for (int i = 0; i < a.length; i++) {
				if((max-a[i])%2==0)a[i]=max;
				else a[i]=max-1;
			}

			boolean decide=true;
			for (int i = 0; i < a.length; i++) {
				if(a[i]<max) {
					decide=false;
					break;
				}
			}
			if(decide)System.out.println("YES");
			else System.out.println("NO");

		}
	}
}


import java.util.Scanner;

public class YetAnotherTetrisProblem {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int wh = sc.nextInt();

        while(wh > 0) {
            int n = sc.nextInt(), max = 0, somma = 0;
            for(int i = 0; i < n; i++) {
                int newmax = sc.nextInt();
                somma += newmax;
                if(newmax > max) max = newmax;
            }
            if((max * n - somma) % 2 == 0) System.out.println("YES");
            else System.out.println("NO");
            wh--;
        }
    }
}


import java.util.Scanner;

public class YetAnotherTetrisProblem {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int wh = sc.nextInt();

        while(wh > 0) {
            int sum = 0, n = sc.nextInt();

            for(int _ = 0; _ < n; _++) {
                sum += sc.nextInt() % 2;
            }

            if(sum == 0 || sum == n)System.out.println("YES");
            else System.out.println("NO");
            wh--;
        }
    }
}


    import java.util.*;

    public class fuck {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int t =in.nextInt();
            while(t-- >0) {
                int even=0,odd=0;
                int n = in.nextInt();
                int arr[] = new int[n];
                for(int i=0;i<n;i++) {
                    arr[i] = in.nextInt();
                    if(arr[i]%2==0) even++;
                    else odd++;
                }
                if(odd*even ==0)  System.out.println("YES");
                else System.out.println("NO");

            }
        }
    }