#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 2e5 + 1;
int n;
int a[N];
vector<int> g[N];
int depth(int u) {
  if (g[u].size() == 0) return 0;
  int d = -10;
  for (int v : g[u]) d = max(d, depth(v));
  return 1 + d;
}
void MATHA_NOSHTO() {
  cin >> n;
  for (int i = 1; i <= n; i++) g[i].clear();
  for (int i = 0; i < n; i++) cin >> a[i];
  queue<int> q;
  q.push(1);
  int p = 1;
  while (q.size()) {
    int u = q.front();
    q.pop();
    if (p < n) {
      q.push(a[p]);
      g[u].push_back(a[p]);
      p++;
    }
    while (p < n && a[p] > a[p - 1]) {
      q.push(a[p]);
      g[u].push_back(a[p]);
      p++;
    }
  }
  cout << depth(1) << '\n';
}
void MATHA_READY() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(20);
  MATHA_READY();
  int T;
  cin >> T;
  while (T--) {
    MATHA_NOSHTO();
  }
  return 0;
}
