#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    bool flag = 1;
    vector<int> p(n + 1);
    map<int, int> pos;
    for (int i = 1; i <= n; i++) {
      cin >> p[i];
      pos[p[i]] = i;
    }
    vector<bool> val(n, 0);
    int current = 1, last = n;
    while (current <= n) {
      int temp = current;
      for (int i = pos[current]; i <= last; i++) {
        if (current > n || val[i]) break;
        if (p[i] != current) flag = 0;
        val[i] = 1;
        current++;
      }
      last = min(last, pos[temp] - 1);
      if (current == temp) current++;
    }
    if (flag)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
