#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
vector<long long> factorial;
void fill_factorial(long long n) {
  factorial.resize(n + 1);
  factorial[0] = 1;
  for (long long i = 1; i <= n; i++)
    factorial[i] = (factorial[i - 1] * i) % mod;
}
long long gcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long d = gcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
long long binpow(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
long long inv(long long a) {
  long long x, y;
  long long g = gcd(a, mod, x, y);
  x = (x % mod + mod) % mod;
  return x;
}
long long CC(long long n, long long k) {
  return factorial[n] * inv(factorial[k]) % mod * inv(factorial[n - k]) % mod;
}
void solve() {
  long long n;
  cin >> n;
  long long a[n + 1];
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  long long h = 0;
  queue<pair<long long, long long>> q;
  q.push(make_pair(1, 0));
  long long j = 2;
  long long ans = 0;
  while (true) {
    long long val = q.front().first, t = q.front().second;
    ans = max(ans, t);
    q.pop();
    q.push(make_pair(a[j], t + 1));
    j++;
    while (j <= n && a[j] > a[j - 1]) {
      if (j > n) break;
      q.push(make_pair(a[j], t + 1));
      j++;
    }
    if (j > n) break;
  }
  while (!q.empty()) {
    ans = max(ans, q.front().second);
    q.pop();
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long no_of_test_cases;
  cin >> no_of_test_cases;
  while (no_of_test_cases--) {
    solve();
  }
  return 0;
}
