#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (auto &i : v) cin >> i;
    long long ans = 0;
    long long ptr = 1;
    queue<long long> q;
    q.push(1);
    long long cnt = 1;
    while (!q.empty()) {
      long long c = 0;
      for (long long i = 0; i < cnt; i++) {
        q.pop();
        long long compare = -1;
        while (ptr < n) {
          if (v[ptr] < compare) {
            break;
          }
          q.push(v[ptr]);
          compare = v[ptr];
          ptr++;
          c++;
        }
      }
      cnt = c;
      if (q.size()) ans++;
    }
    cout << ans << endl;
  }
}
