#include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(),(x).end()
#define sax(x) cout << #x << '=' << x << endl
#define int long long

template <class T> istream& operator>>(istream &I, pair<T,T>& p) {return I >> p.first >> p.second;}
template <class T> ostream& operator<<(ostream &O, const pair<T,T>& p) {return O << p.first << ' ' << p.second;}
template <class T> istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}

void MAIN() {
        int n; cin >> n;
        vector<int> vec(n + 1);
        for (int i = 1; i <= n; i++) cin >> vec[i];
        vector<int> chooses(n + 1);
        for (int i = 1; i <= n; i++) chooses[vec[i]] = i;
//        cout << chooses << '\n';

        vector<bool> vis(n + 1);
        vis[chooses[1]] = true;
        for (int i = 2; i <= n; i++) {
                if (chooses[i - 1] == n) {
                        vis[chooses[i]] = true;
                        continue;
                } else {
                        if (chooses[i - 1] + 1 != chooses[i] && !vis[chooses[i - 1] + 1]) {
                                cout << "No\n";
                                return;
                        } else {
                                vis[chooses[i]] = true;
                        }
                }
        }

        cout << "Yes\n";
}

signed main() { /*[J][O][L][S][K][E][Y]*/
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int t = 1;
        cin >> t;
        while (t--) MAIN();
        return 0;
}


#include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(),(x).end()
#define sax(x) cout << #x << '=' << x << endl
#define int long long

template <class T> istream& operator>>(istream &I, pair<T,T>& p) {return I >> p.first >> p.second;}
template <class T> ostream& operator<<(ostream &O, const pair<T,T>& p) {return O << p.first << ' ' << p.second;}
template <class T> istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}

void MAIN() {
        int n; cin >> n;
        vector<int> vec(n + 1);
        for (int i = 1; i <= n; i++) cin >> vec[i];
        vector<int> chooses(n + 1);
        for (int i = 1; i <= n; i++) chooses[vec[i]] = i;
//        cout << chooses << '\n';

        vector<bool> vis(n + 2);
        vis[chooses[1]] = true;
        for (int i = 3; i <= n; i++) {
                if (chooses[i] != chooses[i - 1] + 1 && !vis[chooses[i - 1] + 1]) {
                        cout << "No\n";
                        return;
                }
                vis[chooses[i]] = true;
        }

        cout << "Yes\n";
}

signed main() { /*[J][O][L][S][K][E][Y]*/
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int t = 1;
        cin >> t;
        while (t--) MAIN();
        return 0;
}


#include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(),(x).end()
#define sax(x) cout << #x << '=' << x << endl
#define int long long

template <class T> istream& operator>>(istream &I, pair<T,T>& p) {return I >> p.first >> p.second;}
template <class T> ostream& operator<<(ostream &O, const pair<T,T>& p) {return O << p.first << ' ' << p.second;}
template <class T> istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}

void MAIN() {
        int n; cin >> n;
        vector<int> vec(n + 1);
        for (int i = 1; i <= n; i++) cin >> vec[i];
        vector<int> chooses(n + 1);
        for (int i = 1; i <= n; i++) chooses[vec[i]] = i;
//        cout << chooses << '\n';

        vector<bool> vis(n + 2);
        vis[chooses[1]] = true;
        for (int i = 3; i <= n; i++) {
                if (chooses[i] != chooses[i - 1] + 1 && !vis[chooses[i - 1] + 1] && chooses[i - 1] + 1 > n) {
                        cout << "No\n";
                        return;
                }
                vis[chooses[i]] = true;
        }

        cout << "Yes\n";
}

signed main() { /*[J][O][L][S][K][E][Y]*/
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int t = 1;
        cin >> t;
        while (t--) MAIN();
        return 0;
}


#include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(),(x).end()
#define sax(x) cout << #x << '=' << x << endl
#define int long long

template <class T> istream& operator>>(istream &I, pair<T,T>& p) {return I >> p.first >> p.second;}
template <class T> ostream& operator<<(ostream &O, const pair<T,T>& p) {return O << p.first << ' ' << p.second;}
template <class T> istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}

void MAIN() {
        int n; cin >> n;
        vector<int> vec(n + 1);
        for (int i = 1; i <= n; i++) cin >> vec[i];
        vector<int> chooses(n + 1);
        for (int i = 1; i <= n; i++) chooses[vec[i]] = i;
//        cout << chooses << '\n';

        vector<bool> vis(n + 2);
        vis[chooses[1]] = true;
        for (int i = 3; i <= n; i++) {
                if (chooses[i] != chooses[i - 1] + 1 && !vis[chooses[i - 1] + 1] && chooses[i - 1] + 1 != n) {
                        cout << "No\n";
                        return;
                }
                vis[chooses[i]] = true;
        }

        cout << "Yes\n";
}

signed main() { /*[J][O][L][S][K][E][Y]*/
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int t = 1;
        cin >> t;
        while (t--) MAIN();
        return 0;
}


#include <bits/stdc++.h>
using namespace::std;
#define all(x) (x).begin(),(x).end()
#define sax(x) cout << #x << '=' << x << endl
#define int long long

template <class T> istream& operator>>(istream &I, pair<T,T>& p) {return I >> p.first >> p.second;}
template <class T> ostream& operator<<(ostream &O, const pair<T,T>& p) {return O << p.first << ' ' << p.second;}
template <class T> istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}

void MAIN() {
        int n; cin >> n;
        vector<int> vec(n + 1);
        for (int i = 1; i <= n; i++) cin >> vec[i];
        vector<int> chooses(n + 1);
        for (int i = 1; i <= n; i++) chooses[vec[i]] = i;
//        cout << chooses << '\n';

        vector<bool> vis(n + 1);
        vis[chooses[1]] = true;
        for (int i = 3; i <= n; i++) {
                if (chooses[i] != chooses[i - 1] + 1 && !vis[chooses[i - 1] + 1]) {
                        cout << "No\n";
                        return;
                }
                vis[chooses[i]] = true;
        }

        cout << "Yes\n";
}

signed main() { /*[J][O][L][S][K][E][Y]*/
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int t = 1;
        cin >> t;
        while (t--) MAIN();
        return 0;
}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;
        if(a[0]==n)
        {   s.erase(n);
            if(n>1)
            a[0]=a[1]-1;

        }
        s.erase(a[0]);

        for(int i=1;i<n;i++)
        {
            auto it=s.begin();
            if(a[i]==a[i-1]+1)
            {
                if(a[i]==*it)
                    if(i<n-1)
                        a[i]=a[i+1]-1;
                s.erase(a[i]);
                continue;

            }
            else if(a[i]!=a[i-1]+1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;

        for(int i=0;i<n-1;i++)
        {

            if(a[i]!=a[i+1]-1&&a[i]<a[i+1]&&i<n-1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;
        if(a[0]==n)
        {   s.erase(n);
            if(n>1)
            a[0]=a[1]-1;

        }
        s.erase(a[0]);

        for(int i=1;i<n;i++)
        {
            auto it=s.begin();
            if(a[i]==a[i-1]+1)
            {
                s.erase(a[i]);
                if(a[i]==*it)
                    if(i<n-1)
                        a[i]=a[i+1]-1;

                continue;

            }
            else if(a[i]!=a[i-1]+1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;
        s.erase(a[0]);
        if(a[0]==n)
        {   //s.erase(n);
            if(n>1)
            a[0]=a[1]-1;

        }

        for(int i=1;i<n;i++)
        {
            auto it=s.begin();
            if(a[i]==a[i-1]+1)
            {
                s.erase(a[i]);
                if(a[i]==*it)
                    if(i<n-1)
                        a[i]=a[i+1]-1;

                continue;

            }
            else if(a[i]!=a[i-1]+1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;
        if(a[0]==n)
        {   s.erase(n);
            if(n>1)
            a[0]=a[1]-1;

        }
        else s.erase(a[0]);

        for(int i=1;i<n;i++)
        {
            auto it=s.begin();
            if(a[i]==a[i-1]+1)
            {
                s.erase(a[i]);
                if(a[i]==*it)
                    if(i<n-1)
                        a[i]=a[i+1]-1;

                continue;

            }
            else if(a[i]!=a[i-1]+1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;
        s.erase(a[0]);
        if(a[0]==n)
        {   //s.erase(n);
            if(n>1)
            a[0]=a[1]-1;

        }

        for(int i=1;i<n;i++)
        {
            auto it=s.begin();
            if(a[i]==a[i-1]+1)
            {

                if(a[i]==*it)
                    {
                        s.erase(a[i]);
                        if(i<n-1)
                        a[i]=a[i+1]-1;
                    }
                else s.erase(a[i]);
                continue;

            }
            else if(a[i]!=a[i-1]+1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


//coded by armish_123//
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;
signed main()
{
    fast
    int t=1;
    cin>>t;
    while(t--)
    {

        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)cin>>a[i];
        set <int, greater <int> > s;

        for(int i=1;i<=n;i++)
            s.insert(i);
        int maxi=n;
        int flag=0;
        if(a[0]==n)
        {   s.erase(n);
            if(n>1)
            a[0]=a[1]-1;

        }
        else {
            s.erase(a[0]);
        }

        for(int i=1;i<n;i++)
        {
            auto it=s.begin();
            if(a[i]==a[i-1]+1)
            {
                s.erase(a[i]);
                if(a[i]==*it)
                   {
                       if(i<n-1)
                        {
                            a[i]=a[i+1]-1;
                        }
                   }

                //continue;

            }
            else if(a[i]!=a[i-1]+1)
            {
                flag++;
            }

        }
        if(flag)
            cout<<"NO"<<endl;
        else cout<<"YES"<<endl;

    }

}


#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);
const int MAXN = 100010;

int r[MAXN];
int find(int x) {
  if(r[x] != x) r[x] = find(r[x]);
  return r[x];
};
void join(int x, int y) {
  if(x<y) swap(x, y);
  int x_ = find(x);
  int y_ = find(y);
  if(x_!=y_) r[y_] = r[x_];
};

void solve(){
  int n; cin >> n;
  vi order(n+1);
  vi count(n+10, 1);

  priority_queue<ii, vii> pq;

  for(int i=1; i<=n; i++) {
    int x; cin >> x;
    order[x] = i;
    r[i] = i;
    pq.push(ii(1, i));
  }
  r[n+1] = n+1;

  for(int i=1; i<=n; i++) {
    int cur = order[i];
    while(!count[pq.top().ss]) pq.pop();
    ii max = pq.top();

    // cout << cur << " " << max.ff << " " << max.ss << endl;
    if(count[cur] < max.ff) {
      cout << "No" << endl;
      return;
    }

    if(cur != n && find(cur+1) <= n) {
      count[find(cur+1)] += count[cur];
      join(cur, find(cur+1));
      pq.push(ii(count[find(cur+1)], find(cur+1)));
    }
    else r[cur] = n+1;
    count[cur] = 0;

  }
  cout << "Yes" << endl;
}

int main() { BUFF
  int t; cin >> t;
  while(t--) solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);
const int MAXN = 100010;

void solve(){
  int n; cin >> n;
  vi order(n+1);
  vi count(n+1, 1);
  vi r(n+1, 0);
  multiset<int> maxs;

  for(int i=1; i<=n; i++) {
    int x; cin >> x;
    order[x] = i;
  }

  for(int i=1; i<=n; i++) {
    maxs.insert(count[i]);
    r[i] = i;
  }

  for(int i=1; i<=n; i++) {
    int cur = order[i];
    int max = *maxs.rbegin();
    // cout << i << " " << cur << " " << max << endl;
    if(count[cur] < max) {
      cout << "No" << endl;
      return;
    }

    if(cur == n) {
      maxs.erase(maxs.find(count[cur]));
      count[cur] = 0;
      r[cur] = -1;
    }
    else {
      int pos = cur;
      auto it = maxs.find(count[cur+1]);
      if(it != maxs.end()) maxs.erase(it);

      while(pos >= 1 && r[pos] == cur) {
        if(count[pos]) {
          auto it = maxs.find(count[pos]);
          if(it != maxs.end()) maxs.erase(it);
        }

        count[cur+1] += count[pos];
        count[pos] = 0;
        r[pos] = r[cur+1];
        pos--;
      }
      if(r[cur+1] != -1) maxs.insert(count[cur+1]);
    }

    // for(int i=1; i<=n; i++) cout << r[i] << " ";
    // cout << endl;

    // for(int i=1; i<=n; i++) cout << count[i] << " ";
    // cout << endl << endl;

  }
  cout << "Yes" << endl;
}

int main() { BUFF
  int t; cin >> t;
  while(t--) solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);
const int MAXN = 100010;

int r[MAXN];
int find(int x) {
  if(r[x] != x) r[x] = find(r[x]);
  return r[x];
};

void join(int x, int y) {
  if(x<y) swap(x, y);
  int x_ = find(x);
  int y_ = find(y);
  if(x_!=y_) r[y_] = r[x_];
};

void solve(){
  int n; cin >> n;
  vi order(n+1);
  vi count(n+10, 1);

  priority_queue<ii, vii> pq;

  for(int i=1; i<=n; i++) {
    int x; cin >> x;
    order[x] = i;
  }

  for(int i=1; i<=n; i++) {
    pq.push(ii(1, i));
    r[i] = i;
  }

  for(int i=1; i<=n; i++) {
    int cur = order[i];
    while(!count[pq.top().ss]) pq.pop();
    ii max = pq.top();

    // cout << cur << " " << max.ff << " " << max.ss << endl;
    if(count[cur] < max.ff) {
      cout << "No" << endl;
      return;
    }

    if(cur != n && find(cur+1) <= n) {
      count[find(cur+1)] += count[cur];
      join(cur, find(cur+1));
      pq.push(ii(count[find(cur+1)], find(cur+1)));
    }
    else r[cur] = n+1;
    count[cur] = 0;

    // for(int i=1; i<=n; i++) cout << r[i] << " ";
    // cout << endl;
  }
  cout << "Yes" << endl;
}

int main() { BUFF
  int t; cin >> t;
  while(t--) solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);
const int MAXN = 100010;

int r[MAXN];

int find(int x) {
  if(r[x] != x) r[x] = find(r[x]);
  return r[x];
};

void join(int x, int y) {
  if(x<y) swap(x, y);
  int x_ = find(x);
  int y_ = find(y);
  if(x_!=y_) r[y_] = r[x_];
};

void solve(){
  int n; cin >> n;
  vi order(n+1);
  vi count(n+10, 1);

  priority_queue<ii, vii> pq;

  for(int i=1; i<=n; i++) {
    int x; cin >> x;
    order[x] = i;
  }

  for(int i=1; i<=n; i++) {
    pq.push(ii(1, i));
    r[i] = i;
  }

  for(int i=1; i<=n; i++) {
    int cur = order[i];
    while(!count[pq.top().ss]) {
      // cout << "Poppin " << pq.top().ff <<  " " << pq.top().ss << endl;
      pq.pop();
    }
    ii max = pq.top();

    // cout << cur << " " << max.ff << " " << max.ss << endl;
    if(count[cur] < max.ff) {
      cout << "No" << endl;
      return;
    }

    if(cur != n && r[cur+1] <= n) {
      count[find(cur+1)] += count[cur];
      join(cur, find(cur+1));
      pq.push(ii(count[find(cur+1)], find(cur+1)));
    }
    else r[cur] = n+1;
    count[cur] = 0;

    // for(int i=1; i<=n; i++) cout << r[i] << " ";
    // cout << endl;
  }
  cout << "Yes" << endl;
}

int main() { BUFF
  int t; cin >> t;
  while(t--) solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);
const int MAXN = 100010;

int r[MAXN];

int find(int x) {
  if(r[x] != x) r[x] = find(r[x]);
  return r[x];
};

void join(int x, int y) {
  if(x<y) swap(x, y);
  int x_ = find(x);
  int y_ = find(y);
  if(x_!=y_) r[y_] = r[x_];
};

void solve(){
  int n; cin >> n;
  vi order(n+1);
  vi count(n+1, 1);

  priority_queue<ii, vii> pq;

  for(int i=1; i<=n; i++) {
    int x; cin >> x;
    order[x] = i;
  }

  for(int i=1; i<=n; i++) {
    pq.push(ii(1, i));
    r[i] = i;
  }

  for(int i=1; i<=n; i++) {
    int cur = order[i];
    while(!count[pq.top().ss]) {
      // cout << "Poppin " << pq.top().ff <<  " " << pq.top().ss << endl;
      pq.pop();
    }
    ii max = pq.top();

    // cout << cur << " " << max.ff << " " << max.ss << endl;
    if(count[cur] < max.ff) {
      cout << "No" << endl;
      return;
    }

    if(cur != n && r[cur+1] <= n) {
      count[find(cur+1)] += count[cur];
      join(cur, find(cur+1));
      pq.push(ii(count[find(cur+1)], find(cur+1)));
    }
    else r[cur] = n+1;
    count[cur] = 0;

    // for(int i=1; i<=n; i++) cout << r[i] << " ";
    // cout << endl;
  }
  cout << "Yes" << endl;
}

int main() { BUFF
  int t; cin >> t;
  while(t--) solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);
const int MAXN = 100010;

void solve(){
  int n; cin >> n;
  vi order(n+1);
  vi count(n+1, 1);
  vi r(n+1, 0);
  multiset<int> maxs;

  for(int i=1; i<=n; i++) {
    int x; cin >> x;
    order[x] = i;
  }

  for(int i=1; i<=n; i++) {
    maxs.insert(count[i]);
    r[i] = i;
  }

  for(int i=1; i<=n; i++) {
    int cur = order[i];
    int max = *maxs.rbegin();
    // cout << i << " " << cur << " " << max << endl;
    if(count[cur] < max) {
      cout << "No" << endl;
      return;
    }

    if(cur == n) {
      maxs.erase(maxs.find(count[cur]));
      count[cur] = 0;
      r[cur] = -1;
    }
    else {
      int pos = cur;
      auto it = maxs.find(count[cur+1]);
      if(it != maxs.end()) maxs.erase(it);

      while(pos >= 1 && r[pos] == cur) {
        auto it = maxs.find(count[pos]);
        if(it != maxs.end()) maxs.erase(it);

        count[cur+1] += count[pos];
        count[pos] = 0;
        r[pos] = r[cur+1];
        pos--;
      }
      if(r[cur+1] != -1) maxs.insert(count[cur+1]);
    }

    // for(int i=1; i<=n; i++) cout << r[i] << " ";
    // cout << endl;

    // for(int i=1; i<=n; i++) cout << count[i] << " ";
    // cout << endl << endl;

  }
  cout << "Yes" << endl;
}

int main() { BUFF
  int t; cin >> t;
  while(t--) solve();
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool check(vector<int> &p, vector<int> &ch);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        int n;
        cin>>n;
        vector<int> p;
        vector<int> ch(n);
        for(int i=0;i<n;++i){
            int temp;
            cin>>temp;
            ch[i] = 0;
            p.push_back(temp);

        }
        if(check(p,ch)){
            cout<<"Yes"<<endl;
        }else{cout<<"No"<<endl;}

    }
    return 0;
}

bool check(vector<int> &p, vector<int> &ch){
    int n = p.size();
    for(int i=0;i<n-1;++i){
        if(p[i]<p[i+1]){
            if(p[i+1]-p[i]!=1){
                return false;
            }
            ch[p[i]]=1;
        }else{
            ch[p[i]]=1;
            for(int j = p[i];j<n;++j){
                if(ch[p[i]]!=1){
                    return false;
                }
            }
        }
    }
    return true;
}


#include <bits/stdc++.h>
using namespace std;
bool check(vector<int> &p, vector<int> &ch);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        int n;
        cin>>n;
        vector<int> p;
        vector<int> ch(n);
        for(int i=0;i<n;++i){
            int temp;
            cin>>temp;
            ch[temp-1] = 0;
            p.push_back(temp);

        }
        if(check(p,ch)){
            cout<<"Yes"<<endl;
        }else{cout<<"No"<<endl;}

    }
    return 0;
}

bool check(vector<int> &p, vector<int> &ch){
    int n=p.size();
    for(int i=0;i<n-1;++i){
        if(ch[p[i]-1]==1){
            continue;
        }
        ch[p[i]-1]=1;
        if(p[i]<p[i+1]){
            if(p[i+1]-p[i]==1){
                ch[p[i+1]-1]=1;
            }else{return false;}
        }else{
            for(int k=p[i]-1;k<n;++k){
                if(ch[k]==0){
                    return false;
                }
            }
        }
    }
    return true;
}


#include <bits/stdc++.h>
using namespace std;
int sum1(vector<int> &de, int i, int j);
bool check(vector<int> &p, vector<int> &ch);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        long long n;
        cin>>n;
        vector<int> p;
        vector<int> ch(n);
        for(int i=0;i<n;++i){
            int temp;
            cin>>temp;
            ch[i] = 0;
            p.push_back(temp);

        }
        if(check(p, ch)){
            cout<<"Yes"<<endl;
        }else{cout<<"No"<<endl;}

    }
    return 0;
}

bool check(vector<int> &p, vector<int> &ch){
    long long n = p.size();
    for(int i=0;i<n-1;++i){
        if(p[i]<p[i+1]){
            if(p[i+1]-p[i]!=1){
                return false;
            }
            ch[p[i]]=1;
        }else{
            ch[p[i]]=1;
            for(int j = p[i];j<n;++j){
                if(ch[p[i]]!=1){
                    return false;
                }
            }
        }
    }
    return true;
}


#include <bits/stdc++.h>
using namespace std;
bool check(vector<long long int> &p, vector<long long int> &ch);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        long long n;
        cin>>n;
        vector<long long int> p;
        vector<long long int> ch(n);
        for(int i=0;i<n;++i){
            long long int temp;
            cin>>temp;
            ch[i] = 0;
            p.push_back(temp);

        }
        if(check(p, ch)){
            cout<<"Yes"<<endl;
        }else{cout<<"No"<<endl;}

    }
    return 0;
}

bool check(vector<long long int> &p, vector<long long int> &ch){
    long long n = p.size();
    for(long long int i=0;i<n-1;++i){
        if(p[i]<p[i+1]){
            if(p[i+1]-p[i]!=1){
                return false;
            }
            ch[p[i]]=1;
        }else{
            ch[p[i]]=1;
            for(long long int j = p[i];j<n;++j){
                if(ch[p[i]]!=1){
                    return false;
                }
            }
        }
    }
    return true;
}


#include <bits/stdc++.h>
using namespace std;
bool check(vector<int> &p, vector<int> &ch);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        int n;
        cin>>n;
        vector<int> p;
        vector<int> ch(n);
        for(int i=0;i<n;++i){
            int temp;
            cin>>temp;
            ch[temp-1] = 0;
            p.push_back(temp);

        }
        if(check(p,ch)){
            cout<<"Yes"<<endl;
        }else{cout<<"No"<<endl;}

    }
    return 0;
}

bool check(vector<int> &p, vector<int> &ch){
    int n=p.size();
    for(int i=0;i<n-1;++i){
        ch[p[i]-1]=1;
        if(p[i]<p[i+1]){
            if(p[i+1]-p[i]==1){
                ch[p[i+1]-1]=1;
            }else{return false;}
        }else{
            for(int k=p[i]-1;k<n;++k){
                if(ch[k]==0){
                    return false;
                }
            }
        }
    }
    return true;
}


#include<bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int& i : p)
        cin >> i;
    vector<int> pos(n);
    for (int i = 0; i < n; ++i)
        pos[--p[i]] = i;
    vector<bool> was(n);
    for (int i = 0; i < n; ++i) {
        if (was[i])
            continue;
        int me = pos[i];
        while (me < n) {
            was[me] = 1;
            if (me + 1 == n) break;
            if (was[me + 1]) break;
            if (p[me + 1] == p[me] + 1) {
                ++me;
                continue;
            }
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

int main() {
    int q;
    cin >> q;
    while (q--)
        solve();
}


#include <bits/stdc++.h>
using namespace std;
int sum1(vector<int> &de, int i, int j);
bool check(vector<int> &p);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        long long n;
        cin>>n;
        vector<int> p;
        for(int i=0;i<n;++i){
            int temp;
            cin>>temp;
            p.push_back(temp);
        }
        if(check(p)){
            cout<<1<<endl;
        }else{cout<<0<<endl;}

    }
    return 0;
}

bool check(vector<int> &p){
    if(p.size()==1){
        return true;
    }
    int i=0;
    while(i<p.size()){
        if(p[i]==1 && i==p.size()-1){
            p.pop_back();
            for(int j=0;j<p.size();++j){
                p[j]-=1;
            }

//            for(auto k:p){
//                cout<<k<<' ';
//            }cout<<endl;

            if(check(p)){return true;}
        }else if(p[i]==1 && i!=p.size()-1){
            break;
        }
        i+=1;
    }
    int c=0;
    for(int j=i;j<p.size();++j){
        c+=1;
        if(p[j]!=c){return false;}
    }
    for(int j=0;j<i;++j){
        c+=1;
        if(p[j]!=c){return false;}
    }
    return true;
}


#include <bits/stdc++.h>
using namespace std;
void solve(){
    int n;
    cin >> n;

    vector<int> p(n);
    for (int& i : p){
        cin >> i;
    }
    vector<int> pos(n);

    for (int i = 0; i < n; ++i){
        pos[--p[i]] = i;
    }

    vector<bool> was(n);
    for(int i=0;i<n;++i){
        if(was[i]){continue;}
        int posi = pos[i];
        while (posi<n) {
            was[posi]=1;
            if(posi+1==n){break;}
            if(was[posi+1]){break;}
            if(p[posi+1]==p[posi]+1){
                posi+=1;
                continue;
            }
            cout<<"No\n";
            return;
        }
    }
    cout<<"Yes\n";
}

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int sum1(vector<int> &de, int i, int j);
bool check(vector<int> &p);

int main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>t;
    while(t-->0){
        long long n;
        cin>>n;
        vector<int> p;
        for(int i=0;i<n;++i){
            int temp;
            cin>>temp;
            p.push_back(temp);
        }
        if(check(p)){
            cout<<"Yes"<<endl;
        }else{cout<<"No"<<endl;}

    }
    return 0;
}

bool check(vector<int> &p){
    if(p.size()==1){
        return true;
    }
    int i=0;
    while(i<p.size()){
        if(p[i]==1 && i==p.size()-1){
            p.pop_back();
            for(int j=0;j<p.size();++j){
                p[j]-=1;
            }

//            for(auto k:p){
//                cout<<k<<' ';
//            }cout<<endl;

            if(check(p)){return true;}
        }else if(p[i]==1 && i!=p.size()-1){
            break;
        }
        i+=1;
    }
    int c=0;
    for(int j=i;j<p.size();++j){
        c+=1;
        if(p[j]!=c){return false;}
    }
    for(int j=0;j<i;++j){
        c+=1;
        if(p[j]!=c){return false;}
    }
    return true;
}


#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     pll                     pair<ll,ll>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     VLL                     vector<ll>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(int i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((bool)((mask)&(1LL<<pos)))
#define     setf(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     sett(mask,pos)          (is_set(mask,pos)?:flip(mask,pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger
{
    template<typename T> debugger& operator, (const T v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//double log(double a,ll b){return log(b)/log(a);}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#define  LM 100007
int t,n,tmp;
VI seq;
unordered_map<int,int> pos;
bool placed[LM];

int main()
{
    //fastIO;cintie;
    cin>>t;
    while(t--) {
        mems(placed,0);
        seq.clear();
        pos.clear();
        cin>>n;
        for(int i=0;i<n;++i) {
            cin>>tmp;
            seq.pb(tmp);
            pos[tmp] = i;
        }
        int complete = n;
        bool res = true;
        for(int i=1;i<=n;++i){
            if(placed[i]){
                continue;
            }
            int idx = pos[i];
            if(idx>complete){
                res = false;
                break;
            }
            int j = i;
            placed[i] = true;
            while(++j<=n && ++idx<complete){
                if(idx!=pos[j]){
                    res = false;
                    break;
                }
                placed[j] = true;
            }

            if(res== false){
                break;
            }

            complete = i;
        }
        if(res){
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     pll                     pair<ll,ll>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     VLL                     vector<ll>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(int i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((bool)((mask)&(1LL<<pos)))
#define     setf(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     sett(mask,pos)          (is_set(mask,pos)?:flip(mask,pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger
{
    template<typename T> debugger& operator, (const T v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//double log(double a,ll b){return log(b)/log(a);}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#define  LM 100007
int t,n,tmp;
VI seq;
unordered_map<int,int> pos;
bool placed[LM];

int main()
{
    //fastIO;cintie;
    cin>>t;
    while(t--) {
        mems(placed,0);
        seq.clear();
        pos.clear();
        cin>>n;
        for(int i=0;i<n;++i) {
            cin>>tmp;
            seq.pb(tmp);
            pos[tmp] = i;
        }
        int complete = n-1;
        bool res = true;
        for(int i=1;i<=n;++i){
            if(placed[i]){
                continue;
            }
            int idx = pos[i];
            if(idx>complete){
                res = false;
                break;
            }

            placed[i] = true;
            while(++i<=n && ++idx<complete){
                if(idx!=pos[i]){
                    res = false;
                    break;
                }
            }

            if(res== false){
                break;
            }
        }
        if(res){
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     pll                     pair<ll,ll>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     VLL                     vector<ll>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(int i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((bool)((mask)&(1LL<<pos)))
#define     setf(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     sett(mask,pos)          (is_set(mask,pos)?:flip(mask,pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger
{
    template<typename T> debugger& operator, (const T v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//double log(double a,ll b){return log(b)/log(a);}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#define  LM 100007
int t,n,tmp;
VI seq;
unordered_map<int,int> pos;
bool placed[LM];

int main()
{
    //fastIO;cintie;
    cin>>t;
    while(t--) {
        mems(placed,0);
        seq.clear();
        pos.clear();
        cin>>n;
        for(int i=0;i<n;++i) {
            cin>>tmp;
            seq.pb(tmp);
            pos[tmp] = i;
        }
        int complete = n;
        bool res = true;
        for(int i=1;i<=n;++i){
            if(placed[i]){
                continue;
            }
            int idx = pos[i];
            if(idx>complete){
                res = false;
                break;
            }
            int j = i;
            placed[i] = true;
            while(++j<=n && ++idx<complete){
                if(idx!=pos[j]){
                    res = false;
                    break;
                }
            }

            if(res== false){
                break;
            }

            complete = i;
        }
        if(res){
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     pll                     pair<ll,ll>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     VLL                     vector<ll>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(int i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((bool)((mask)&(1LL<<pos)))
#define     setf(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     sett(mask,pos)          (is_set(mask,pos)?:flip(mask,pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger
{
    template<typename T> debugger& operator, (const T v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//double log(double a,ll b){return log(b)/log(a);}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#define  LM 100007
int t,n,tmp;
VI seq;
unordered_map<int,int> pos;
bool placed[LM];

int main()
{
    fastIO;cintie;
    cin>>t;
    while(t--) {
        mems(placed,0);
        seq.clear();
        pos.clear();
        cin>>n;
        for(int i=0;i<n;++i) {
            cin>>tmp;
            seq.pb(tmp);
            pos[tmp] = i;
        }
        int complete = n;
        bool res = true;
        for(int i=1;i<=n;++i){
            if(placed[i]){
                continue;
            }
            int idx = pos[i];
            if(idx>complete){
                res = false;
                break;
            }
            int j = i;
            placed[i] = true;
            while(++j<=n && ++idx<complete){
                if(idx!=pos[j]){
                    res = false;
                    break;
                }
                placed[j] = true;
            }

            if(res== false){
                break;
            }

            complete = pos[i];
        }
        if(res){
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     pll                     pair<ll,ll>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     VLL                     vector<ll>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(int i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((bool)((mask)&(1LL<<pos)))
#define     setf(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     sett(mask,pos)          (is_set(mask,pos)?:flip(mask,pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger
{
    template<typename T> debugger& operator, (const T v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//double log(double a,ll b){return log(b)/log(a);}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#define  LM 100007
int t,n,tmp;
VI seq;
unordered_map<int,int> pos;
bool placed[LM];

int main()
{
    //fastIO;cintie;
    cin>>t;
    while(t--) {
        mems(placed,0);
        cin>>n;
        for(int i=0;i<n;++i) {
            cin>>tmp;
            seq.pb(tmp);
            pos[tmp] = i;
        }
        int complete = n-1;
        bool res = true;
        for(int i=1;i<=n;++i){
            if(placed[i]){
                continue;
            }
            int idx = pos[i];
            if(idx>complete){
                res = false;
                break;
            }

            placed[i] = true;
            while(++i<=n && ++idx<complete){
                if(idx!=pos[i]){
                    res = false;
                    break;
                }
            }

            if(res== false){
                break;
            }
        }
        if(res){
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define     ll                      long long
#define     ull                     unsigned long long
#define     mems(a,b)               memset(a,b,sizeof(a))
#define     mp                      make_pair
#define     pii                     pair<int,int>
#define     pdd                     pair<double,double>
#define     pll                     pair<ll,ll>
#define     fs                      first
#define     sc                      second
#define     VI                      vector<int>
#define     VLL                     vector<ll>
#define     clr(a)                  a.clear()
#define     pb                      push_back
#define     eps                     1E-5
#define     sf                      scanf
#define     pf                      printf
#define     For(i,a,b)              for(int i=a;i<=b;++i)
#define     all(a)                  a.begin(),a.end()
#define     fread(name)             freopen(name,"r",stdin)
#define     fwrite(name)            freopen(name,"w",stdout)
#define     sz(a)                   (int)a.size()
#define     cone                    __builtin_popcountll
#define     fastIO                  ios_base::sync_with_stdio(false)
#define     cintie                  cin.tie(NULL)
#define     endl                    "\n"
#define     PI                      (acos(-1.0))
#define     linf                    (1LL<<62)
#define     inf                     (0x7f7f7f7f)
#define     sqr(a)                  ((a)*(a))
#define     lcm(a,b)                ({(a)/__gcd(a,b)*(b);})
#define     is_set(mask,pos)        ((bool)((mask)&(1LL<<pos)))
#define     setf(mask,pos)          ((mask)&(~(1LL<<pos)))
#define     flip(mask,pos)          ((mask)^(1LL<<pos))
#define     sett(mask,pos)          (is_set(mask,pos)?:flip(mask,pos))
#define     debv(v)                 for(int i=0;i<sz(v);++i)(!i?cout<<v[i]:cout<<" "<<v[i]);cout<<endl;
#define     deba(arr,l)             for(int i=0; i<l; i++)(!i?cout<<arr[i]:cout<<" "<<arr[i]);cout<<endl;
#define     deb(a...)               {cerr<<"#line:"<<__LINE__<<" -> ";dbg,a; cerr<<endl;}
struct debugger
{
    template<typename T> debugger& operator, (const T v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int X[]={1,1,2,2,-1,-1,-2,-2},Y[]={2,-2,1,-1,2,-2,1,-1};
//int X[]={0,-1,-1,-1,0,1,1,1},Y[]={-1,-1,0,1,1,1,0,-1};
//int X[]={-1,0,1,0},Y[]={0,1,0,-1};
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//int bigMod(int a,int x,int p){int r=1;while(x>0){if(x%2!=0){r=(r*a)%p;}a=(a*a)%p;x=(x>>1);}return r;}
//int modInverse(int a, int p){return bigMod(a,p-2,p);}
//int extGcd(int a,int b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extGcd(b,a%b,y,x);y-=a/b*x;return g;}}
//double log(double a,ll b){return log(b)/log(a);}
//template<class T> T pwr(T b, T p){T r=1,x=b;while(p){if(p&1)r*=x;x*=x;p=(p>>1);}return r;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//struct triple{double f,s,t;triple() {} triple(double a,double b,double c){f=a,s=b,t=c;}};
//int cross_product(triple a,triple b){int v=a.f*(b.s-b.t)-a.s*(b.f-b.t)+a.t*(b.f-b.s);return (v==0?0:(v>0?+1:-1));}
//triple make_vector(triple s,triple e){triple a;a.f=e.f-s.f;a.s=e.s-s.s;a.t=e.t-s.t;return a;}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//double pdis(pdd a,pdd b){return sqrt((double)sqr(a.fs-b.fs)+sqr(a.sc-b.sc));}
//template<class T> double rAng(T a,T b,T c){double d=(sqr(a)+sqr(b)-sqr(c))/(a*b*2);d=(d<-1?-1:(d>1?1:d));return acos(d);}
///~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//template<class T> string to_str(T n){ostringstream oss;oss<<n;oss.flush();return oss.str();}
//template<typename T>T str_to(const string& s){T d;istringstream(s) >> d;return d;}
///HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
#define  LM 100007
int t,n,tmp;
VI seq;
unordered_map<int,int> pos;
bool placed[LM];

int main()
{
    //fastIO;cintie;
    cin>>t;
    while(t--) {
        mems(placed,0);
        seq.clear();
        pos.clear();
        //cin>>n;
        n = 5;
        for(int i=0;i<n;++i) {
            cin>>tmp;
            seq.pb(tmp);
            pos[tmp] = i;
        }
        int complete = n;
        bool res = true;
        for(int i=1;i<=n;++i){
            if(placed[i]){
                continue;
            }
            int idx = pos[i];
            if(idx>complete){
                res = false;
                break;
            }
            int j = i;
            placed[i] = true;
            while(++j<=n && ++idx<complete){
                if(idx!=pos[j]){
                    res = false;
                    break;
                }
                placed[j] = true;
            }

            if(res== false){
                break;
            }

            complete = pos[i];
        }
        if(res){
            cout<<"Yes"<<endl;
        } else {
            cout<<"No"<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int main()
{
   int t;cin>>t;
   while(t--){
      bool ok=true;
      int n;cin>>n;
      int a[n+1],b[n+1],x=0;a[0]=-1;
      for(int i=1;i<=n;i++){
         cin>>a[i];
         if(a[i]-a[i-1]!=1){b[x]=a[i];x++;}
      }
      for(int i=1;i<x;i++){
         if(b[i]>b[i-1]){ok=false;break;}
      }
      cout<<(ok?"Yes\n":"No\n");
   }
}


#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int main()
{
   int t;
   cin>>t;
   while(t--){
      bool ok=true;
      int n,p,x=1,mx[100001];mx[0]=1;
      cin>>n;
      int a[n+1],b[n+2];b[n+1]=0;
      for(int i=1;i<=n;i++){
         cin>>p;
         a[p]=i;
      }for(int i=1;i<=n;i++)b[i]=1;
      for(int i=1;i<=n;i++){
         if(mx[x-1]!=b[a[i]]){ok=false;break;}
         if(b[a[i]+1]!=0)
         {b[a[i]+1]=b[a[i]+1]+b[a[i]];b[a[i]]=0;
         mx[x]=max(b[a[i]+1],mx[x-1]);}
         else{
            if(b[a[i]]==mx[x-1])mx[x]=mx[x-2];else mx[x]=mx[x-1];b[a[i]]=0;
         }x++;
      }
      cout<<(ok?"Yes\n":"No\n");
   }
}


#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int maxel(int b[],int n){
   int mx=0;
   for(int i=1;i<=n;i++)mx=max(mx,b[i]);
   return mx;
}
int main()
{
   int t;
   cin>>t;
   while(t--){
      bool ok=true;
      int n,p,mx=1;
      cin>>n;
      int a[n+1],b[n+2];b[n+1]=0;
      for(int i=1;i<=n;i++){
         cin>>p;
         a[p]=i;
      }for(int i=1;i<=n;i++)b[i]=1;
      for(int i=1;i<=n;i++){
         if(mx!=b[a[i]]){ok=false;break;}
         if(b[a[i]+1]!=0)
         {b[a[i]+1]=b[a[i]+1]+b[a[i]];b[a[i]]=0;
         mx=max(b[a[i]+1],mx);}
         else{
            b[a[i]]=0;mx=maxel(b,n);
         }
      }
      cout<<(ok?"Yes\n":"No\n");
   }
}


#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int maxel(int b[],int n){
   int mx=0;
   for(int i=1;i<=n;i++)mx=max(mx,b[i]);
   return mx;
}
int main()
{
   int t;
   cin>>t;
   while(t--){
      bool ok=true;
      int n,p,mx=1;
      cin>>n;
      int a[n+1],b[n+2];b[n+1]=0;
      for(int i=1;i<=n;i++){
         cin>>p;
         a[p]=i;
      }for(int i=1;i<=n;i++)b[i]=1;
      for(int i=1;i<=n;i++){
         if(mx!=b[a[i]]){ok=false;break;}
         if(b[a[i]+1]!=0)
         {b[a[i]+1]=b[a[i]+1]+b[a[i]];b[a[i]]=0;
         mx=max(b[a[i]+1],mx);}
         else{
            if(mx==b[a[i]]){b[a[i]]=0;
            mx=maxel(b,n);}b[a[i]]=0;
         }
      }
      cout<<(ok?"Yes\n":"No\n");
   }
}


#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int maxel(int b[],int n){
   int mx=0;
   for(int i=1;i<=n;i++)mx=max(mx,b[i]);
   return mx;
}
int main()
{
   int t;
   cin>>t;
   while(t--){
      bool ok=true;
      int n,p,mx=1;
      cin>>n;
      int a[n+1],b[n+2];b[n+1]=0;
      for(int i=1;i<=n;i++){
         cin>>p;
         a[p]=i;
      }for(int i=1;i<=n;i++)b[i]=1;
      for(int i=1;i<=n;i++){
         if(mx!=b[a[i]]){ok=false;break;}
         if(b[a[i]+1]!=0)
         {b[a[i]+1]=b[a[i]+1]+b[a[i]];b[a[i]]=0;
         mx=max(b[a[i]+1],mx);}
         else{
            if(mx==b[a[i]])
            mx=maxel(b,n);b[a[i]]=0;
         }
      }
      cout<<(ok?"Yes\n":"No\n");
   }
}


#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int maxel(int a[],int n){
   int mx=0;
   for(int i=1;i<=n;i++)mx=max(a[i],mx);
   return mx;
}
int main()
{
   int t;
   cin>>t;
   while(t--){
      bool ok=true;
      int n,p,mx=1;
      cin>>n;
      int a[n+1],b[n+2];b[n+1]=0;
      for(int i=1;i<=n;i++){
         cin>>p;
         a[p]=i;
      }for(int i=1;i<=n;i++)b[i]=1;
      for(int i=1;i<=n;i++){
         if(mx!=b[a[i]]){ok=false;break;}
         if(b[a[i]+1]!=0)
         b[a[i]+1]=b[a[i]+1]+b[a[i]];b[a[i]]=0;
         mx=maxel(b,n);
      }
      cout<<(ok?"Yes\n":"No\n");
   }
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N);
    vector<int> hash(N + 1);

    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }

    for(int i = p[0]; i < N - 1; i++)
    {
        if (p[i] != p[i + 1] - 1)
        {
            if (p[i] < p[i + 1])
            {
                cout << "No\n";
            }
        }
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N + 1);
    vector<int> hash(N + 1);

    for (int i = 1; i <= N; i++)
    {
        cin >> p[i];
        hash[p[i]] = i;
    }

    int i = 1;
    while (i < N)
    {
        for (int j = hash[i]; j + 1 < N + 1; j++)
        {
            if (p[j] == p[j + 1] - 1)
            {
                continue;
            }

            if (p[j] > p[j + 1])
            {
                i = p[j];
                break;
            }

            cout << "No\n";
            return;
        }
        i++;
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N);
    vector<int> hash(N + 1);

    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }

    for(int i = 0; i < N - 1; i++)
    {
        if (p[i] != p[i + 1] - 1)
        {
            if (p[i] < p[i + 1])
            {
                cout << "No\n";
                return;
            }
        }
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N);
    vector<int> hash(N + 1);

    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }

    for(int i = 0; i < N - 1; i++)
    {
        if (p[i] != p[i + 1] - 1)
        {
            if (p[i] < p[i + 1])
            {
                cout << "No\n";
            }
        }
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N + 1);
    vector<int> hash(N + 1);

    for (int i = 1; i <= N; i++)
    {
        cin >> p[i];
        hash[p[i]] = i;
    }

    for(int i = 1; i <= N; i++)
    {
        for (int j = hash[i]; j + 1 < N + 1; j++)
        {
            if (p[j] == p[j + 1] - 1)
            {
                continue;
            }

            if (p[j] > p[j + 1])
            {
                i = p[j];
                break;
            }

            cout << "No\n";
            return;
        }
        i++;
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N + 1);
    vector<int> hash(N + 1);

    for (int i = 1; i <= N; i++)
    {
        cin >> p[i];
        hash[p[i]] = i;
    }

    int i = 1;
    while (i < N)
    {
        for (int j = hash[i]; j < N; j++)
        {
            if (p[j] == p[j + 1] - 1)
            {
                continue;
            }

            if (p[j] > p[j + 1])
            {
                i = j;
                break;
            }

            cout << "No\n";
            return;
        }
        i++;
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include<stack>
#include<queue>

#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007

using namespace std;

void solve()
{
    int N;
    cin >> N;

    vector<int> p(N + 1);
    vector<int> hash(N + 1);

    for (int i = 1; i <= N; i++)
    {
        cin >> p[i];
        hash[p[i]] = i;
    }

    for(int i = 1; i < N; i++)
    {
        for (int j = hash[i]; j + 1 < N + 1; j++)
        {
            if (p[j] == p[j + 1] - 1)
            {
                continue;
            }

            if (p[j] > p[j + 1])
            {
                i = p[j];
                break;
            }

            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=1e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st,sst;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();sst.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;c[i]=0;
            if(a[i]==n) {st.insert(i);sta=i;}
        }
        sst.insert(sta);
        c[sta]=sta;
        int flag=0;
        dep(i,n-1,2){
            it=st.lower_bound(pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            sst.erase(pos[i]);
            sst.insert(pos[i]-l+1);
            c[pos[i]]=pos[i]-l+1;
            sst.erase(c[r]);
            sst.insert(c[r]-(pos[i]-l+1));
            c[r]=c[r]-(pos[i]-l+1);
            int ans=*(--sst.end());
            if(ans>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=1e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st,sst;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();sst.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;c[i]=0;
            if(a[i]==n) {st.insert(i);sta=i;}
        }
        sst.insert(sta);
        c[sta]=sta;
        int flag=0;
        dep(i,n-1,2){
            it=st.lower_bound(pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            sst.insert(pos[i]-l+1);
            c[pos[i]]=pos[i]-l+1;
            sst.erase(c[r]);
            sst.insert(c[r]-(pos[i]-l+1));
            c[r]=c[r]-(pos[i]-l+1);
            int ans=*(--sst.end());
            if(ans>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=4e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
struct tree {
	int l, r;
	LL dat, sum, add;
} t[maxn << 2];

void build(int p, int l, int r) {
	l(p) = l, r(p) = r;
	if (l == r) {return ; }
	int mid = (l + r) >> 1;
	build(p << 1, l, mid);
	build(p << 1 | 1, mid + 1, r);
	dat(p) = dat(p << 1) + dat(p << 1 | 1);
//	sum(p) = sum(p << 1) + sum(p << 1 | 1);
}

void spread(int p) {
	if (add(p)) {
//		sum(p << 1) = add(p) * (r(p << 1) - l(p << 1) + 1);
//		sum(p << 1 | 1) = add(p) * (r(p << 1 | 1) - l(p << 1 | 1) + 1);
		add(p << 1) += add(p);
		add(p << 1 | 1) += add(p);
		dat(p << 1) += add(p);
		dat(p << 1 | 1) += add(p);
		add(p) = 0;
	}
}

void change(int p, int l, int r, int d) {
	if (l <= l(p) && r >= r(p)) {
		sum(p) += (LL) d * (r(p) - l(p) + 1);
		add(p) += d;
		dat(p) += d;
		return ;
	}
	spread(p);
	int mid = (l(p) + r(p)) >> 1;
	if (l <= mid) change(p << 1, l, r, d);
	if (r > mid) change(p << 1 | 1, l, r, d);
	sum(p) = sum(p << 1) + sum(p << 1 | 1);
	dat(p) = max(dat(p << 1), dat(p << 1 | 1));
}

LL ask(int p, int l, int r) {
	if (l <= l(p) && r >= r(p)) return dat(p);
	spread(p);
	int mid = (l(p) + r(p)) >> 1;
	LL val = 0;
	if (l <= mid) val = max(val, ask(p << 1, l, r));
	if (r > mid)  val = max(val, ask(p << 1 | 1, l, r));
	return val;
}
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(p,0,4*n) sum(p)=dat(p)=add(p)=0;
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;
            if(a[i]==n) {a[i]=0;st.insert(i);sta=i;}
        }
        rep(i,1,sta) {c[i]=sta;}
        build(1, 1, n);
        change(1,sta,sta,sta);
        int flag=0;
        dep(i,n-1,2){
            it=lower_bound(st.begin(),st.end(),pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            change(1,pos[i],pos[i],pos[i]-l+1);
            //cout<<ask(1,1,n)<<endl;
            if(r<=n) change(1,r,r,-(pos[i]-l+1));
            //rep(k,1,n) cout<<s[k]<<" * "<<endl;
            //cout<<i<<" "<<" "<<l<<" "<<r<<" "<<ask(1,1,n)<<" "<<pos[i]-l+1<<endl;
            if(ask(1,1,n)>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=1e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st;
multiset<int>sst;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();sst.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;c[i]=0;
            if(a[i]==n) {st.insert(i);sta=i;}
        }
        sst.insert(sta);
        c[sta]=sta;
        int flag=0;
        dep(i,n-1,2){
            it=st.lower_bound(pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            sst.insert(pos[i]-l+1);
            c[pos[i]]=pos[i]-l+1;
            sst.erase(c[r]);
            sst.insert(c[r]-(pos[i]-l+1));
            c[r]=c[r]-(pos[i]-l+1);
            int ans=*(--sst.end());
            if(ans>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=1e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st;
multiset<int>sst;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();sst.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;c[i]=0;
            if(a[i]==n) {st.insert(i);sta=i;}
        }
        sst.insert(sta);
        c[sta]=sta;
        int flag=0;
        dep(i,n-1,2){
            it=st.lower_bound(pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            sst.insert(pos[i]-l+1);
            c[pos[i]]=pos[i]-l+1;
            if(r<=n) sst.erase(c[r]);
            if(r<=n) sst.insert(c[r]-(pos[i]-l+1));
            if(r<=n) c[r]=c[r]-(pos[i]-l+1);
            int ans=*(--sst.end());
            if(ans>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=4e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
struct tree {
	int l, r;
	LL dat, sum, add;
} t[maxn << 2];

void build(int p, int l, int r) {
	l(p) = l, r(p) = r;
	if (l == r) { sum(p)=dat(p)=add(p)= 0; return ; }
	int mid = (l + r) >> 1;
	build(p << 1, l, mid);
	build(p << 1 | 1, mid + 1, r);
	dat(p) = dat(p << 1) + dat(p << 1 | 1);
//	sum(p) = sum(p << 1) + sum(p << 1 | 1);
}

void spread(int p) {
	if (add(p)) {
//		sum(p << 1) = add(p) * (r(p << 1) - l(p << 1) + 1);
//		sum(p << 1 | 1) = add(p) * (r(p << 1 | 1) - l(p << 1 | 1) + 1);
		add(p << 1) += add(p);
		add(p << 1 | 1) += add(p);
		dat(p << 1) += add(p);
		dat(p << 1 | 1) += add(p);
		add(p) = 0;
	}
}

void change(int p, int l, int r, int d) {
	if (l <= l(p) && r >= r(p)) {
		sum(p) += (LL) d * (r(p) - l(p) + 1);
		add(p) += d;
		dat(p) += d;
		return ;
	}
	spread(p);
	int mid = (l(p) + r(p)) >> 1;
	if (l <= mid) change(p << 1, l, r, d);
	if (r > mid) change(p << 1 | 1, l, r, d);
	sum(p) = sum(p << 1) + sum(p << 1 | 1);
	dat(p) = max(dat(p << 1), dat(p << 1 | 1));
}

LL ask(int p, int l, int r) {
	if (l <= l(p) && r >= r(p)) return dat(p);
	spread(p);
	int mid = (l(p) + r(p)) >> 1;
	LL val = 0;
	if (l <= mid) val = max(val, ask(p << 1, l, r));
	if (r > mid)  val = max(val, ask(p << 1 | 1, l, r));
	return val;
}
int main()
{
    int T,cas=1;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d",&n);
        set<int>st;
        set<int>::iterator it;
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,0,n+1)
        {
            c[i]=cnt[i]=s[i]=0;
        }
        rep(p,0,4*n) sum(p)=dat(p)=add(p)=0;
        rep(i,1,n) {
            scanf("%d",&a[i]);
            pos[a[i]]=i;
            if(a[i]==n) {a[i]=0;st.insert(i);sta=i;}
        }
        rep(i,1,sta) {c[i]=sta;}
        build(1, 1, n);
        change(1, sta,sta,sta);
        int flag=0;
        dep(i,n-1,2){
            it=lower_bound(st.begin(),st.end(),pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            change(1,pos[i],pos[i],pos[i]-l+1);
            //cout<<ask(1,1,n)<<endl;
            if(r<=n) change(1,r,r,-(pos[i]-l+1));
            //rep(k,1,n) cout<<s[k]<<" * "<<endl;
            //cout<<i<<" "<<" "<<l<<" "<<r<<" "<<ask(1,1,n)<<" "<<pos[i]-l+1<<endl;
            if(ask(1,1,n)>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=1e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st;
set<int>::iterator itt;
multiset<int>sst;
multiset<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();sst.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;c[i]=0;
            if(a[i]==n) {st.insert(i);sta=i;}
        }
        sst.insert(sta);
        c[sta]=sta;
        int flag=0;
        dep(i,n-1,2){
            itt=st.lower_bound(pos[i]);
            int r=(*itt);
            int l=*(--itt)+1;
            st.insert(pos[i]);
            sst.insert(pos[i]-l+1);
            c[pos[i]]=pos[i]-l+1;
            if(r<=n) {
                it=sst.find(c[r]);
                sst.erase(it);
                sst.insert(c[r]-(pos[i]-l+1));
                c[r]=c[r]-(pos[i]-l+1);
            }
            int ans=*(--sst.end());
            if(ans>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=1e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
struct tree { int l, r, dat; }t[maxn << 2];

inline int ls(int p) { return p << 1; }
inline int rs(int p) { return ((p << 1) | 1); }

inline void build(int p, int l, int r) {
	t[p].l = l, t[p].r = r;
	if (l == r) { t[p].dat = 0; return ; }
	int mid = (l + r) >> 1;
	build(ls(p), l, mid);
	build(rs(p), mid + 1, r);
	t[p].dat = max(t[ls(p)].dat, t[rs(p)].dat);
}

inline void change(int p, int x, int v) {
	if (t[p].l == t[p].r) { t[p].dat = v; return ; }
	int mid = (t[p].l + t[p].r) >> 1;
	if (x <= mid) change(ls(p), x, v);
	else change(rs(p), x, v);
	t[p].dat = max(t[ls(p)].dat, t[rs(p)].dat);
}

inline int ask(int p, int l, int r) {
	if (l <= t[p].l && r >= t[p].r) return t[p].dat;
	int mid = (t[p].l + t[p].r) >> 1;
	int val = -inf;
	if (l <= mid) val = max(val, ask(ls(p), l, r));
	if (r > mid) val = max(val, ask(rs(p), l, r));
	return val;
}
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;
            if(a[i]==n) {a[i]=0;st.insert(i);sta=i;}
        }
        rep(i,1,sta) {c[i]=sta;}
        build(1, 1, n);
        change(1,sta,sta);
        int flag=0;
        dep(i,n-1,2){
            it=lower_bound(st.begin(),st.end(),pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            change(1,pos[i],pos[i]-l+1);
            int s=0;
            if(r<=n) s=ask(1,r,r);
            if(r<=n) change(1,r,s-(pos[i]-l+1));
            int ans=ask(1,1,n);
            if(ans>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define inf 0x3f3f3f3f
#define l(x) t[x].l
#define r(x) t[x].r
#define dat(x) t[x].dat
#define sum(x) t[x].sum
#define add(x) t[x].add
#define rep(i,a,b) for(register int i=(a);i<=(b);i++)
#define dep(i,a,b) for(register int i=(a);i>=(b);i--)
using namespace std;
const int maxn=4e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
int n,m,k;
int a[maxn],c[maxn];
int ans,tmp;
int flag;
int cnt[maxn],pos[maxn],s[maxn];
struct tree { int l, r, dat; }t[maxn << 2];

inline int ls(int p) { return p << 1; }
inline int rs(int p) { return ((p << 1) | 1); }

inline void build(int p, int l, int r) {
	t[p].l = l, t[p].r = r;
	if (l == r) { t[p].dat = 0; return ; }
	int mid = (l + r) >> 1;
	build(ls(p), l, mid);
	build(rs(p), mid + 1, r);
	t[p].dat = max(t[ls(p)].dat, t[rs(p)].dat);
}

inline void change(int p, int x, int v) {
	if (t[p].l == t[p].r) { t[p].dat = v; return ; }
	int mid = (t[p].l + t[p].r) >> 1;
	if (x <= mid) change(ls(p), x, v);
	else change(rs(p), x, v);
	t[p].dat = max(t[ls(p)].dat, t[rs(p)].dat);
}

inline int ask(int p, int l, int r) {
	if (l <= t[p].l && r >= t[p].r) return t[p].dat;
	int mid = (t[p].l + t[p].r) >> 1;
	int val = -inf;
	if (l <= mid) val = max(val, ask(ls(p), l, r));
	if (r > mid) val = max(val, ask(rs(p), l, r));
	return val;
}
template <typename T>
inline void read(T &s) {
    s = 0;
    T w = 1, ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') w = -1; ch = getchar(); }
    while (isdigit(ch))  { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
    s *= w;
}
set<int>st;
set<int>::iterator it;
int main()
{
    int T,cas=1;
    read(T);
    while(T--)
    {
        read(n);
        st.clear();
        int sta;
        st.insert(0);st.insert(n+1);
        rep(i,1,n) {
            read(a[i]);
            pos[a[i]]=i;
            if(a[i]==n) {a[i]=0;st.insert(i);sta=i;}
        }
        rep(i,1,sta) {c[i]=sta;}
        build(1, 1, n);
        change(1,sta,sta);
        int flag=0;
        dep(i,n-1,2){
            it=lower_bound(st.begin(),st.end(),pos[i]);
            int r=(*it);
            int l=*(--it)+1;
            st.insert(pos[i]);
            change(1,pos[i],pos[i]-l+1);
            int s=0;
            if(r<=n) s=ask(1,r,r);
            if(r<=n) change(1,r,s-(pos[i]-l+1));
            //rep(k,1,n) cout<<s[k]<<" * "<<endl;
            //cout<<i<<" "<<" "<<l<<" "<<r<<" "<<ask(1,1,n)<<" "<<pos[i]-l+1<<endl;
            if(ask(1,1,n)>pos[i]-l+1) {flag=1;break;}
        }
        if(flag) puts("No");
        else puts("Yes");
    }
    return 0;
}