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.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws Exception
	{
	    Main ob=new Main();
	    ob.fun();
	}
	public void fun()throws Exception
	{
	    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    PrintWriter pw=new PrintWriter(System.out);
	    int t=Integer.parseInt(br.readLine());
	    while(t-->0)
	    {
	        int n=Integer.parseInt(br.readLine());
	        String s[]=(br.readLine()).split(" ");
	        int a[]=new int[n];
	        int even[]=new int[100001];
	        int odd[]=new int[100001];
	        
	        Integer A[]=new Integer[n];
	        for(int i=0;i<n;i++)
	        {
	            a[i]=Integer.parseInt(s[i]);
	            if(i%2==0)
	            {
	                even[a[i]]++;
	            }
	            else
	            {
	                odd[a[i]]++;
	            }
	            A[i]=new Integer(a[i]);
	        }
	        Arrays.sort(A);
	        int a2[]=new int[n];
	        for(int i=0;i<n;i++)
	        {
	            a2[i]=(int)(A[i]);
	        }
	        boolean ok=true;
	        for(int i=0;i<n;i++)
	        {
	            if(i%2==0)
	            {
	                if(even[a2[i]]>0)
	                {
	                    even[a2[i]]--;
	                }
	                else
	                {
	                    ok=false;
	                    break;
	                }
	            }
	            else
	            {
	                if(odd[a2[i]]>0)
	                {
	                    odd[a2[i]]--;
	                }
	                else
	                {
	                    ok=false;
	                    break;
	                }
	            }
	        }
	        if(ok)
	        {
	            pw.println("YES");
	        }
	        else
	        {
	            pw.println("NO");
	        }
	    }
	    pw.flush();
	}
	public long gcd(long a,long b)
	{
	    if(a==0)
	    {
	        return b;
	    }
	    return gcd(b%a,a);
	}
	public int floorSearch(int arr[], int low,int high, int x)
    {
        // If low and high cross each other
        if (low > high)
            return -1;
 
        // If last element is smaller than x
        if (x >= arr[high])
            return high;
 
        // Find the middle point
        int mid = (low + high) / 2;
 
        // If middle point is floor.
        if (arr[mid] == x)
            return mid;
 
        // If x lies between mid-1 and mid
        if (
            mid > 0 && arr[mid - 1] <= x && x < arr[mid])
            return mid - 1;
 
        // If x is smaller than mid, floor
        // must be in left half.
        if (x < arr[mid])
            return floorSearch(
                arr, low,
                mid - 1, x);
 
        // If mid-1 is not floor and x is
        // greater than arr[mid],
        return floorSearch(
            arr, mid + 1, high,
            x);
    }
	public int ceilSearch(int arr[], int low, int high, int x)
    {
      int mid;   
       
      /* If x is smaller than or equal to the
         first element, then return the first element */
      if(x <= arr[low])
        return low;
      
      /* If x is greater than the last
         element, then return -1 */
      if(x > arr[high])
        return -1; 
      
      /* get the index of middle element
         of arr[low..high]*/
      mid = (low + high)/2;  /* low + (high - low)/2 */
      
      /* If x is same as middle element,
         then return mid */
      if(arr[mid] == x)
        return mid;
          
      /* If x is greater than arr[mid], then
         either arr[mid + 1] is ceiling of x or
         ceiling lies in arr[mid+1...high] */
      else if(arr[mid] < x)
      {
        if(mid + 1 <= high && x <= arr[mid+1])
          return mid + 1;
        else
          return ceilSearch(arr, mid+1, high, x);
      }
      
      /* If x is smaller than arr[mid],
         then either arr[mid] is ceiling of x
         or ceiling lies in arr[low...mid-1] */  
      else
      {
        if(mid - 1 >= low && x > arr[mid-1])
          return mid;
        else   
          return ceilSearch(arr, low, mid - 1, x);
      }
    }
	
}