#include <bits/stdc++.h>
using namespace std;
int n;
int tc = -1;
int solve();
int main() {
  if (tc < 1) cin >> tc;
  while (tc--) solve();
  return 0;
}
int solve() {
  cin >> n;
  vector<int> a(n);
  for (auto i = (n) - (n); i < (n); i++) cin >> a[i];
  vector<int> d(n, -1);
  d[0] = 0;
  int p = 0;
  d[1] = 1;
  int maxd = 1;
  for (int i = 2; i < n; i++) {
    if (a[i] < a[i - 1]) p++;
    d[i] = d[p] + 1;
    maxd = max(maxd, d[i]);
  }
  cout << maxd << endl;
  return 0;
}
