#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fu first
#define sx second
#define pl pair<ll,ll>
#define vl vector<ll>
#define vpl vector<pl>
#define mll map<ll,ll>
#define pb push_back
#define mpr make_pair
#define in1(a) \
ll a; \
cin >> a;
#define in2(a, b) \
ll a, b; \
cin >> a >> b
#define in3(a, b, c) \
ll a, b, c; \
cin >> a >> b >> c
#define in4(a, b, c, d) \
ll a, b, c, d; \
cin >> a >> b >> c >> d
#define outv(v) \
for (auto i : v) \
cout << i << " "; \
cout << endl;
#define outp(v) \
for (auto i : v) \
cout << i.fi << " " << i.se; \
cout << endl;
#define ld long long double
#define AMATERASU return 0;
#define out(x) cout << x << endl;
#define all(v) v.begin(), v.end()
#define nahi cout << "NO" << endl;
#define oyeah cout << "YES" << endl;
#define qll queue<long long>
#define pqll priority_queue<long long>
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define vsort(V) sort(V.begin(),V.end())
#define rsort(V) sort(V.begin(),V.end(),greater<ll>())
#define MAX(V) *max_element(V.begin(),V.end())
#define MIN(V) *min_element(V.begin(),V.end())
#define rbd int test; cin >> test; while(test--)
#define ReZero {ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define vin(vec,n,type) for(ll i=0;i<n;i++){type p;cin >> p;vec.push_back(p);}
#define pin(vec,n,type1,type2) for(ll i=0;i<n;i++){type1 p; type2 q;cin >> p>>q;vec.push_back(make_pair(p,q));}
#define ain(a,n) for(ll i=0;i<n;i++){cin>>a[i];}
#define every(m) for(auto p:m)
#define fine(x,V) find(V.begin(),V.end(),x);
bool pot(ll n){
ll c=0;
while(n>0){
if((n&1)==1){
c++;
}
n=n>>1;
}
if(c==1) return true;
else return false;
}
signed main(){
ReZero;
rbd{
ll n;
cin>>n;
vl v;
vin(v,n,ll);
ll c=0,a=1;
while(a<n){
a=a*2;
}
a=a/2;
// cout<<a<<endl;
ll i=2,f=0;
while(i<n){
if(pot(i)){
i++;
continue;
}
else{
if(v[i]<v[i-1]){
f=1;break;
}
}
i++;
}
// cout<<endl;
if(f) nahi
else oyeah
}
AMATERASU
}
908D - New Year and Arbitrary Arrangement | 199A - Hexadecimal's theorem |
519C - A and B and Team Training | 631A - Interview |
961B - Lecture Sleep | 522A - Reposts |
1166D - Cute Sequences | 1176A - Divide it |
1527A - And Then There Were K | 1618E - Singers' Tour |
1560B - Who's Opposite | 182B - Vasya's Calendar |
934A - A Compatible Pair | 1618F - Reverse |
1684C - Column Swapping | 57C - Array |
1713D - Tournament Countdown | 33A - What is for dinner |
810A - Straight A | 1433C - Dominant Piranha |
633A - Ebony and Ivory | 1196A - Three Piles of Candies |
299A - Ksusha and Array | 448B - Suffix Structures |
1092B - Teams Forming | 1166C - A Tale of Two Lands |
544B - Sea and Islands | 152B - Steps |
1174D - Ehab and the Expected XOR Problem | 1511A - Review Site |