#include <bits/stdc++.h>
using namespace std;
long long add(int a, int b) {
  return (a % 1000000007 + b % 1000000007 +
          ((8000000000000000064LL) / 1000000007) * 1000000007) %
         1000000007;
}
long long sub(long long a, long long b) {
  return (a % 1000000007 - b % 1000000007 +
          ((8000000000000000064LL) / 1000000007) * 1000000007) %
         1000000007;
}
long long mul(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007) +
          ((8000000000000000064LL) / 1000000007) * 1000000007) %
         1000000007;
}
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int const N = 1e3 + 9;
long long const INF = 2e18 + 5;
long long dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
long long dy[8] = {1, -1, 0, 0, -1, 1, -1, 1};
char dr[4] = {'R', 'L', 'D', 'U'};
vector<vector<long long>> v;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  v = vector<vector<long long>>(n + 1);
  queue<long long> q;
  q.push(1);
  long long i = 1;
  while (!q.empty()) {
    if (i == n) {
      break;
    }
    long long t = a[i], k = q.front();
    q.pop();
    while (a[i] >= t && i < n) {
      q.push(a[i]);
      v[k].push_back(a[i]);
      t = a[i];
      i++;
    }
  }
  queue<pair<long long, long long>> Q;
  Q.push({1, 0});
  long long ans = 0;
  while (!Q.empty()) {
    long long k = Q.front().first, t = Q.front().second;
    ans = max(ans, t);
    Q.pop();
    for (auto x : v[k]) {
      Q.push({x, t + 1});
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
