#include <bits/stdc++.h>   const long long mod = (long long)1e9 + 7;   using namespace std;   vector<long long> parent, sz;   void make_set(long long v) {     parent[v] = v;     sz[v] = 1;   }   long long find_set(long long v) {     if (v == parent[v]) return v;     return parent[v] = find_set(parent[v]);   }   void union_sets(long long a, long long b) {     a = find_set(a);     b = find_set(b);     if (a != b) {       if (a < b) swap(a, b);       parent[b] = a;       sz[a] += sz[b];     }   }   long long n;   void clearall() {     parent.clear();     sz.clear();     parent.resize(n + 1);     sz.resize(n + 1);   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       cin >> n;       vector<long long> vc(n);       for (long long i = 0; i < n; i++) cin >> vc[i];       clearall();       for (long long i = 0; i <= n; i++) {         make_set(i);       }       vector<long long> mp(n + 1, 0);       for (long long i = 0; i < n; i++) {         mp[vc[i]] = i;       }       bool foo = true;       vector<long long> ocp(n, 0);       vector<long long> mxmp(n, 1);       multiset<long long, greater<long long>> st;       for (long long i = 0; i < n; i++) st.insert(1);       for (long long i = 1; i <= n; i++) {         long long mx = *(st.begin());         long long ii = mp[i];         if (mxmp[ii] != mx) {           foo = false;           break;         }         auto it = st.find(mxmp[ii]);         st.erase(it);         if (ii > 0 and ocp[ii - 1] == 1) {           union_sets(ii, ii - 1);         }         if (ii < n - 1 and ocp[ii + 1] == 1) {           union_sets(ii, ii + 1);         }         ocp[ii] = 1;         long long pr = find_set(ii);         if (pr < n - 1 and ocp[pr + 1] == 0) {           it = st.find(mxmp[pr + 1]);           st.erase(it);           mxmp[pr + 1] = sz[pr] + 1;           st.insert(sz[pr] + 1);         }       }       if (foo) {         cout <<  Yes n ;       } else {         cout <<  No n ;       }     }     return 0;   }   