#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N], n, T, res, dep[N];
void bfs() {
  queue<int> q;
  q.push(1);
  int pos = 2, last;
  while (q.size()) {
    int u = q.front();
    q.pop();
    res = max(res, dep[u]);
    last = pos;
    if (pos > n) pos = n;
    for (; a[pos + 1] > a[pos] && pos <= n; pos++)
      ;
    for (int i = last; i <= pos && i <= n; i++) {
      q.push(a[i]);
      dep[a[i]] = dep[u] + 1;
    }
    pos++;
  }
}
int main() {
  cin >> T;
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    res = 0;
    bfs();
    cout << res << endl;
  }
  return 0;
}
