AquaMoon has n friends. They stand in a row from left to right, and the i-th friend from the left wears a T-shirt with a number a_i written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.

AquaMoon can make some operations on friends. On each operation, AquaMoon can choose two adjacent friends and swap their positions. After each operation, the direction of both chosen friends will also be flipped: left to right and vice versa.

AquaMoon hopes that after some operations, the numbers written on the T-shirt of n friends in the row, read from left to right, become non-decreasing. Also she wants, that all friends will have a direction of right at the end. Please find if it is possible.

Input

The input consists of multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 50) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 10^5) — the number of Aquamoon's friends.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^5) — the numbers, written on the T-shirts.

It is guaranteed that the sum of n for all test cases does not exceed 10^5.

Output

For each test case, if there exists a possible sequence of operations, print "YES" (without quotes); otherwise, print "NO" (without quotes).

You can print each letter in any case (upper or lower).

Example

Input


3
4
4 3 2 5
4
3 3 2 2
5
1 2 3 5 4


Output


YES
YES
NO

Note

The possible list of operations in the first test case:

  1. Swap a_1 and a_2. The resulting sequence is 3, 4, 2, 5. The directions are: left, left, right, right. 
  2. Swap a_2 and a_3. The resulting sequence is 3, 2, 4, 5. The directions are: left, left, right, right. 
  3. Swap a_1 and a_2. The resulting sequence is 2, 3, 4, 5. The directions are: right, right, right, right. 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
 
public class Main {
	static int count =1;
//	static Integer[] arr;
	static boolean test = true;
	static int testSet = 0;
	static class Pair{
		int first;
		int second;
		Pair(int first, int second){
			this.first = first;
			this.second = second;
		}
		@Override
		public boolean equals(Object b) {
			Pair a = (Pair)b;
			if(this.first == a.first && this.second==a.second) {
				return true;
			}
			return false;
		}
	}
	class PairSorter implements Comparator<Main.Pair>{
		public int compare(Pair a, Pair b) {
			if(a.first!=b.first) {
				return a.first-b.first;
			}
			return a.second-b.second; 
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = 1;
		T = sc.nextInt();
//		T = Integer.parseInt(sc.nextLine());
		int t1 = T;
		while (T-- > 0) {
			//sc.nextLine();
			int n = sc.nextInt();
			int arr[] = new int[n];
			int brr[] = new int[n];
			for(int i=0;i<n;i++) {
				arr[i] = sc.nextInt();
				brr[i] = arr[i];
			}
			Pair[] aPair = new Pair[n];
			Pair[] bPair = new Pair[n];
			for(int i=0;i<n;i++) {
				aPair[i] = new Pair(arr[i], i%2);
			}
			Arrays.sort(brr);
			for(int i=0;i<n;i++) {
				bPair[i] = new Pair(brr[i], i%2);
			}
			Arrays.sort(aPair, new Main().new PairSorter());
			Arrays.sort(bPair, new Main().new PairSorter());
			String r = "NO";
			if(Arrays.deepEquals(aPair, bPair)) {
				r="YES";
			}
//			System.out.println(Arrays.toString(indArr).replaceAll("\\[|\\]|,", ""));
//			Arrays.sort(indArr, new Comparator<Integer>() {
//				public int compare(Integer a, Integer b) {
//					return arr[a].compareTo(arr[b]);
//				}
//			});
//			boolean isStrangeSort = true;
//			int lastPair = -1;
//			int lastPairIndex = -1;
//			for(int i=0;i<indArr.length;i++) {
//				if(Math.abs(i-indArr[i])%2!=0) {
//					System.out.println(lastPair+" "+lastPairIndex);
//					if(lastPair  == -1) {
//						lastPair = arr[indArr[i]];
//						lastPairIndex = i;
//					}
//					else if((lastPair  == arr[indArr[i]]) && ((i-lastPairIndex)%2!=0)) {
//						lastPair = -1;
//						lastPairIndex = -1;
//					}
//					else {
//						break;
//					}
//				}
//			}
//			System.out.println();
			//int inv[] = new int[n];
			//mergeSortAndCount(arr, 0, arr.length - 1);
			
//			dfs(a, res, 1, false);
//			String s = sc.nextLine();
			
			
			//int res []=solve(a);
//			String r = "NO";
//			if(lastPair == -1) {
//				r="YES";
//			}
//			Arrays.sort(arr);
//			System.out.println(Arrays.toString(arr).replaceAll("\\[|\\]|,", ""));			
//			System.out.println(Arrays.toString(indArr).replaceAll("\\[|\\]|,", ""));

			System.out.println(r);
		}
	}
	public static void dfs(Set<Integer> adjacencyList[], int[] res, int start, boolean isInfinite) {
		if(isInfinite) {
			if(res[start] == -1) {
				return;
			}
			else {
				res[start] = -1;
			}
		}
		else if(res[start] ==0) {
			res[start] =1;
		}
		else {
			res[start] =2;
			return;
		}
		if(adjacencyList[start].contains(start)) {
			isInfinite= true;
		}
		for(Integer val: adjacencyList[start]) {
			dfs(adjacencyList, res, val, isInfinite);
		}
		
	}
	public static int[] solve(int[] a) {
		int res[] = new int[a.length];
		for(int i=1;i<a.length;i++) {
			res[i] = a[i-1]&(~a[i]);
			a[i] = a[i]|res[i];
		}
		return res;
	}

    // Function to count the number of inversions
    // during the merge process
//    private static int mergeAndCount(int[] arr, int[] inv, int l,
//                                     int m, int r)
//    {
// 
//        // Left subarray
//        int[] left = Arrays.copyOfRange(arr, l, m + 1);
// 
//        // Right subarray
//        int[] right = Arrays.copyOfRange(arr, m + 1, r + 1);
//        
//        // Left subarray
//        int[] leftInv = Arrays.copyOfRange(inv, l, m + 1);
// 
//        // Right subarray
//        int[] rightInv = Arrays.copyOfRange(inv, m + 1, r + 1);
// 
//        int i = 0, j = 0, k = l, swaps = 0;
// 
//        while (i < left.length && j < right.length) {
//            if (left[i] <= right[j]) {
//                arr[k++] = left[i++];
//                inv[k-1] = k-i+leftInv[i-1];
//            }
//            else {
//                arr[k++] = right[j++];
//                inv[k-1] = (m + 1) - (l + i) +rightInv[j-1];
//            }
//        }
//        while (i < left.length) {
//            arr[k++] = left[i++];
//            inv[k-1] = k-i+leftInv[i-1];
//        }
//        while (j < right.length)
//            arr[k++] = right[j++];
//        return swaps;
//    }
// 
//    // Merge sort function
//    private static int mergeSortAndCount(int[] arr, int [] inv, int l, int r)
//    {
// 
//        // Keeps track of the inversion count at a
//        // particular node of the recursion tree
//        int count = 0;
// 
//        if (l < r) {
//            int m = (l + r) / 2;
// 
//            // Total inversion count = left subarray count
//            // + right subarray count + merge count
// 
//            // Left subarray count
//            count += mergeSortAndCount(arr, inv, l, m);
// 
//            // Right subarray count
//            count += mergeSortAndCount(arr, inv, m + 1, r);
// 
//            // Merge count
//            count += mergeAndCount(arr, l, m, r);
//        }
// 
//        return count;
//    }
 
//    // Driver code
//    public static void main(String[] args)
//    {
//        int[] arr = { 1, 20, 6, 4, 5 };
// 
//        System.out.println(
//            mergeSortAndCount(arr, 0, arr.length - 1));
//    }
}