#include <bits/stdc++.h>
const int MAXN = 1e5 + 1;
int t, n;
int arr[MAXN];
int brr[MAXN];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      int a;
      scanf("%d", &a);
      arr[i + 1] = a;
    }
    for (int i = 0; i <= n; i++) brr[i] = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; (j * j) <= i; j++) {
        if (i % j == 0) {
          if (arr[j] < arr[i]) {
            brr[i] = std::max(brr[i], brr[j] + 1);
          }
          if (arr[i / j] < arr[i]) {
            brr[i] = std::max(brr[i], brr[i / j] + 1);
          }
        }
      }
    }
    printf("%d\n", *std::max_element(brr, brr + n + 1));
  }
  return 0;
}
