#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    long long i, j, k, l;
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long diff;
    bool value = true;
    for (i = 0; i < n - 1; i++) {
      diff = abs(a[i] - a[i + 1]);
      if (diff == 1) {
        continue;
      }
      if (diff > 1) {
        if (a[i] > a[i + 1]) {
          continue;
        }
        if (a[i] < a[i + 1]) {
          cout << "NO"
               << "\n";
          value = false;
          break;
        }
      }
    }
    if (value) {
      cout << "YES"
           << "\n";
    }
  }
}
