#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const long long int mod = 1e9 + 7;
const int MAXN = 1e6 + 5;
void cp() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int &x : arr) cin >> x;
  reverse(arr.begin(), arr.end());
  arr.pop_back();
  queue<pair<int, int> > q;
  q.push({1, 0});
  int mx_d = 0;
  while (!q.empty()) {
    pair<int, int> node = q.front();
    q.pop();
    int u = node.first, d = node.second;
    mx_d = max(mx_d, d);
    int last = -1;
    vector<int> take;
    while (!arr.empty() && arr.back() > last)
      take.push_back(arr.back()), last = arr.back(), arr.pop_back();
    for (int x : take) q.push({x, d + 1});
  }
  cout << mx_d << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  cin >> t;
  while (t--) {
    cp();
  }
  return 0;
}
