#include <bits/stdc++.h>
using namespace std;
int n;
int len[1000000 + 5];
int input[1000000 + 5];
int ans;
int get_len(int idx) {
  if (len[idx] != -1) return len[idx];
  len[idx] = 1;
  for (int k = 2; 1LL * k * idx <= n; ++k) {
    int cur = get_len(k * idx) + 1;
    if (input[idx] >= input[k * idx]) continue;
    if (cur > len[idx]) len[idx] = cur;
  }
  if (len[idx] > ans) ans = len[idx];
  return len[idx];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    ans = 0;
    for (int i = 1; i <= n; ++i) len[i] = -1;
    for (int i = 1; i <= n; ++i) scanf("%d", &input[i]);
    get_len(1);
    printf("%d\n", ans);
  }
  return 0;
}
