#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
int a[maxn], dp[maxn];
void solve() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), dp[i] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      if (i % j == 0) {
        if (a[i] > a[j]) dp[i] = max(dp[i], dp[j] + 1);
        if (a[i] > a[i / j]) dp[i] = max(dp[i], dp[i / j] + 1);
      }
    }
  }
  for (int i = 1; i <= n; i++) ans = max(ans, dp[i]);
  printf("%d\n", ans);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}
