#include <bits/stdc++.h>
using namespace std;
void dfs(long long int node, long long int dist, long long int par,
         vector<vector<long long int> > &Adj, vector<long long int> &level) {
  level[node] = dist;
  for (long long int child : Adj[node]) {
    if (child == par)
      continue;
    else
      dfs(child, dist + 1, node, Adj, level);
  }
}
void Compute(long long int n) {
  vector<long long int> ar(n);
  vector<vector<long long int> > Adj(n + 1);
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  vector<long long int> level(n + 1);
  level[1] = 1;
  queue<long long int> q;
  q.push(1);
  Adj[1].emplace_back(ar[1]);
  q.push(ar[1]);
  for (long long int i = 2; i < n; i++) {
    if (ar[i] > ar[i - 1]) {
      Adj[q.front()].emplace_back(ar[i]);
      q.push(ar[i]);
    } else {
      q.pop();
      Adj[q.front()].emplace_back(ar[i]);
      q.push(ar[i]);
    }
  }
  dfs(1, 0, -1, Adj, level);
  long long int mx = *max_element(level.begin(), level.end());
  cout << mx << "\n";
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    Compute(n);
  }
}
