#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 1e5 + 5;
void Hariiih() {
  long long int n;
  cin >> n;
  std::vector<long long int> v;
  if (n == 1) {
    cout << 0 << '\n';
    return;
  }
  queue<long long int> tak;
  for (long long int i = 0; i < n; ++i) {
    long long int p;
    cin >> p;
    v.push_back(p);
  }
  long long int height = 1;
  tak.push(v[0]);
  tak.push(-1);
  long long int prev = -1;
  for (long long int i = 1; i < n; i) {
    while (i < n && prev < v[i]) {
      tak.push(v[i]);
      prev = v[i];
      i++;
    }
    if (i == n) break;
    tak.pop();
    prev = -1;
    if (tak.front() == -1) {
      height++;
      tak.pop();
      tak.push(-1);
      prev = -1;
    }
  }
  cout << height << '\n';
  return;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) Hariiih();
  return 0;
}
