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. 
#pragma GCC optimize("Ofast")
 #include <bits/stdc++.h>
#define ll         long long int
#define umap       unordered_map
#define mod        1000000007ll
#define pb         push_back
#define all(x)     (x).begin(), (x).end()
#define rall(x)    (x).rbegin(), (x).rend()
#define MN(a,b,c)  min(a,min(b,c))
#define MX(a,b,c)  max(a,max(b,c))
#define pr1         pair<ll,ll>
#define F          first
#define S          second
#define mP         make_pair
#define f(i,n)     for(ll i=0;i<n;i++)
#define f1(i,x,y)  for(ll i=x;i<=y;i++)
#define f2(i,x,y)  for(ll i=x;i>=y;i--)
#define yes        cout<<"Yes"<<"\n"
#define no         cout<<"No"<<"\n"
#define modsum(a,b)  ((a%mod)+(b%mod))%mod
#define modpro(a,b)  ((a%mod)*(b%mod))%mod
#define moddif(a,b)  ((a%mod)-(b%mod)+mod)%mod
#define modsumt(a,b,c) modsum(a,modsum(b,c))
//__builtin_popcount(x)
//__builtin_parity(x)   =(number of set bits)%2
//__builtin_clz(x)      to count the number of leading  zeroes 
//__builtin_ctz(x)      to count the number of trailing zeroes 
//__gcd(a,b)
// Binary Search 
// TO AVOID GETTING INFINITE LOOP
// mid = (l+r)/2      l=mid+1   r=mid
// mid = (l+r+1)/2    l=mid     r=mid-1
//std::cout << std::fixed; std::cout << std::setprecision(12); std::cout << z ;
using namespace std;
ll fac[1000005];
/*void calc_pow2()
{
    pow2[0]=1;
    for(ll i=1;i<63;i++) pow2[i]=2*pow2[i-1];
}*/
ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=modpro(result,x);
        x=modpro(x,x);
        n=n/2;
    }
    return result;
}
ll binaryExponentiation(ll x,ll n)
{
    ll result=1.0;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}
ll pow1(ll x,ll y)
{
    ll z=1;
    while(y--){z=z*x;}
    return z;
}
bool isprime(ll n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
 
    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;
 
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
 
    return true;
}
// Returns n^(-1) mod p 
ll  modInverse(ll n, ll p) 
{ 
    return modularExponentiation(n, p - 2, p); 
} 
// Returns nCr % p using Fermat's little 
// theorem. 
unsigned long long nCrModPFermat(unsigned long long n, 
                                 ll r, ll p) 
{ 
    // Base case 
    if (r == 0) 
        return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
}
ll check(ll x,ll y)
{
    ll z=1;
    ll ans=0;
    while(z<x){ans++;z*=y;}
    return ans;
}
ll countbits(ll n)
{
    ll x=0;
    while(n>0)
    {
        x++;
        n=(n&(n-1));
    }
    return x;
}
/*
 BFS
 vector <ll> visited(n+1,0);
 vector <ll>  parent(n+1);
 vector <ll>   level(n+1);
 queue <ll> q;
 q.push(1);
 visited[1]=1;
 level[1]=0;
 while(!q.empty())
 {
  	  ll node = q.front();
  	  q.pop();
  	  for(auto z : v[node])
  	  {
  	  	 if(!visited[z])
  	  	 {
  	  	 	level[z]=1+level[node];
  	  	 	parent[z]=node;
  	  	 	visited[z]=1;
  	  	 	q.push(z);
  	  	 }
  	  }
 }
 vector <pair<ll,ll>> lev_node(n);
 f(i,n) lev_node[i]={level[i+1],i+1};
*/
/*
// DSU
ll parent[100005];
ll depth[200005];
void set_values(ll n)
{
    for(ll i=1;i<=n;i++)
    {
        parent[i]=i;
        depth[i]=0;
    }
}
 // Path Compression
ll find_Parent(ll node)
{
    if(node==parent[node])
    {
       return node;
    } 
    return parent[node] = find_Parent(parent[node]);
}
void Union(ll u,ll v)
{
    u=find_Parent(u);
    v=find_Parent(v);
    if(depth[u]<depth[v])
    {
        parent[u] = v;
    }
    else if(depth[v]<depth[u])
    {
        parent[v] = u;
    }
    else 
    {
    	parent[v] = u;
        // since Depth of u and v are same depth of u will increase by 1
        depth[u]++;
    }
}
*/
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t,n;
  cin>>t;
  while(t--)
  {
      cin>>n;
      vector <ll> a(n);
      vector <pair<ll,ll>> v(n);
      f(i,n)
      {
          cin>>a[i];
          v[i]={a[i],i};
      }
      sort(all(v));
      map <ll,ll> odd_pos;
      map <ll,ll> even_pos;
      ll y=1;
      f(i,n)
      {
          if(i%2) odd_pos[v[i].F]++;
          else    even_pos[v[i].F]++;
      }
      f(i,n)
      {
           if(i%2)
           {
               if(odd_pos[a[i]]>0) odd_pos[a[i]]--;
               else             {y=0;break;}
           }
          else   {
               if(even_pos[a[i]]>0) even_pos[a[i]]--;
               else             {y=0;break;}
          }
      }
      if(y) yes;
      else   no;
  }
} 