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 codeforces {
    static int M = 1_000_000_007;
    static int INF = 2_000_000_000;
    static int N = (int)1e5+1;
    static final FastScanner fs = new FastScanner();

    //variable
    public static void main(String[] args) throws IOException {
        int T = fs.nextInt();
        PrintWriter out = new PrintWriter(System.out);
        while(T-- >0) {
            int n = fs.nextInt();
            int[] arr = fs.arrayIn(n);
            int[] copy = Arrays.copyOf(arr,n);
            HashMap<Integer,Integer>[] us = new HashMap[2];
            for(int i=0;i<2;i++) {
                us[i] = new HashMap<>();
            }
            ruffleSort(copy);
            for(int i=0;i<n;i++) {
                if(us[i%2].containsKey(arr[i])) us[i%2].put(arr[i],us[i%2].get(arr[i])+1);
                else  us[i%2].put(arr[i],1);
                if(us[i%2].containsKey(copy[i])) us[i%2].put(copy[i],us[i%2].get(copy[i])-1);
                else  us[i%2].put(copy[i],-1);
            }
            boolean ok = true;
            int[] ans = new int[n];
            for(Map.Entry e : us[0].entrySet()) {
                if ((int) e.getValue() != 0) {
                    ok = false;
                    break;
                }
            }
            System.out.println(ok?"YES":"NO");
        }
    }
    //class

    //function

    // Template
    static long lcm(long a, long b) {
        return (a / gcd(a, b)) * b;
    }

    static long gcd(long a, long b) {
        if(a==0) return b;

        return gcd(b%a,a);
    }
    static void premutation(int n, ArrayList<Integer> arr,boolean[] chosen) {
        if(arr.size() == n) {
            System.out.println(arr);
        }else {
            for(int i=1; i<=n; i++) {
                if(chosen[i]) continue;
                arr.add(i);
                chosen[i] = true;
                premutation(n,arr,chosen);
                arr.remove(new Integer(i));
                chosen[i] = false;
            }
        }
    }
    static boolean isPalindrome(char[] c) {
        int n = c.length;
        for(int i=0; i<n/2; i++) {
            if(c[i] != c[n-i-1]) return false;
        }
        return true;
    }

    static long nCk(int n, int k) {
        return (modMult(fact(n),fastexp(modMult(fact(n-k),fact(k)),M-2)));
    }

    static long fact (long n) {

        long fact =1;
        for(int i=1; i<=n; i++) {
            fact = modMult(fact,i);
        }
        return fact%M;
    }

    static int modMult(long a,long b) {
        return (int) (a*b%M);
    }
    static int negMult(long a,long b) {
        return (int)((a*b)%M + M)%M;
    }
    static long fastexp(long x, int y){
        if(y==1) return x;

        long ans = fastexp(x,y/2);
        if(y%2 == 0) return modMult(ans,ans);
        else return modMult(ans,modMult(ans,x));
    }

    static final Random random = new Random();

    static void ruffleSort(int[] arr)
    {
        int n = arr.length;
        for(int i=0; i<n; i++)
        {
            int j = random.nextInt(n);
            int temp = arr[j];
            arr[j] = arr[i];
            arr[i] = temp;
        }
        Arrays.sort(arr);
    }


    public static class Pairs implements Comparable<Pairs>
    {
        int f,s;
        Pairs(int f, int s)
        {
            this.f = f;
            this.s = s;
        }
        public int compareTo(Pairs p)
        {
            if(this.f != p.f) return Integer.compare(this.f,p.f);
            return  Integer.compare(this.s,p.s);
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Pairs)) return false;
            Pairs pairs = (Pairs) o;
            return f == pairs.f && s == pairs.s;
        }

        @Override
        public int hashCode() {
            return Objects.hash(f, s);
        }
    }
}
class FastScanner
{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer str = new StringTokenizer("");

    String next() throws IOException
    {
        while(!str.hasMoreTokens())
            str = new StringTokenizer(br.readLine());

        return str.nextToken();
    }

    char nextChar() throws IOException {
        return next().charAt(0);
    }

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

    float nextFloat() throws IOException
    {
        return Float.parseFloat(next());
    }

    double nextDouble() throws IOException
    {
        return Double.parseDouble(next());
    }
    long nextLong() throws IOException
    {
        return Long.parseLong(next());
    }
    byte nextByte() throws IOException
    {
        return Byte.parseByte(next());
    }
    int [] arrayIn(int n) throws IOException
    {
        int[] arr = new int[n];
        for(int i=0; i<n; i++)
        {
            arr[i] = nextInt();
        }
        return arr;
    }
}

