#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
inline bool isprime(int n) {
  if (n < 2 || (n % 2 == 0 && n != 2)) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, i;
    cin >> n;
    vector<int> v(n + 1), id(n + 1);
    for (i = 1; i <= n; i++) {
      cin >> v[i];
      id[v[i]] = i;
    }
    int r = 1;
    vector<int> pos;
    int flag = 1;
    while (flag) {
      int j = id[r];
      pos.push_back(id[r]);
      while (j + 1 <= n && v[j] + 1 == v[j + 1]) {
        j++;
      }
      r += (j - id[r]) + 1;
      if (r > n) flag = 0;
    }
    for (i = 0; i < pos.size() - 1; i++) {
      if (pos[i] < pos[i + 1]) {
        flag++;
      }
    }
    if (flag) {
      cout << "No\n";
    } else {
      cout << "Yes\n";
    }
  }
  return 0;
}
