#include <bits/stdc++.h>
using namespace std;
const long long logN = 20;
const long long M = 1000000007;
const long long INF = 1e18;
const long long N = 100005;
void solve() {
  long long n;
  cin >> n;
  long long A[n];
  for (long long i = 0; i < n; i++) cin >> A[i];
  long long pt = 1;
  queue<long long> q;
  q.push(0);
  long long ans = 0;
  while (pt != n) {
    long long lt = A[pt];
    long long h = q.front();
    q.pop();
    q.push(h + 1);
    ans = max(ans, h + 1);
    pt++;
    while (pt != n and A[pt] > lt) {
      lt = A[pt];
      q.push(h + 1);
      pt++;
    }
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long no;
  cin >> no;
  while (no--) {
    solve();
  }
  return 0;
}
