#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
int an[310000];
int q[310000], l, r;
int main() {
  int z;
  int n, m;
  int i, j, k;
  cin >> z;
  while (z--) {
    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%d", &an[i]);
    l = r = 0;
    q[r++] = 0;
    i = 1;
    int ans;
    while (l < r) {
      int h = q[l++];
      bool first = 1;
      for (; i < n; i++) {
        if (first)
          q[r++] = h + 1, first = 0;
        else {
          if (an[i] < an[i - 1]) break;
          q[r++] = h + 1;
        }
        if (i == n - 1) ans = h + 1;
      }
      if (i == n) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}
