#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++) {
      int x;
      cin >> x;
      arr[i] = x;
    }
    int ans = 0;
    vector<int> frontier;
    frontier.push_back(1);
    int ind = 1;
    while (ind < n) {
      vector<int> next;
      for (int i = 0; i < frontier.size(); i++) {
        int prev = -1;
        while (arr[ind] > prev) {
          next.push_back(arr[ind]);
          prev = arr[ind];
          ind++;
        }
      }
      ans++;
      frontier = next;
    }
    cout << ans << endl;
  }
  return 0;
}
