#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    int cnt[n + 1];
    memset(cnt, 0, sizeof cnt);
    cnt[0] = 1;
    int lvl = 0;
    int ind = 1;
    while (ind < n) {
      lvl++;
      for (int i = 0; i < cnt[lvl - 1] && i < n; i++) {
        int last = -1;
        while (ind < n && arr[ind] > last) {
          cnt[lvl]++;
          last = arr[ind];
          ind++;
        }
      }
    }
    cout << lvl << endl;
  }
}
