#include <bits/stdc++.h>
using namespace std;
vector<int> factor[100001];
void sieve() {
  for (int i = 1; i <= 100000; i++) {
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        factor[i].push_back(j);
        factor[i].push_back(i / j);
      }
    }
  }
}
int main() {
  sieve();
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    int a[n + 1];
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int dp[n + 1];
    fill(dp, dp + n + 1, 1);
    dp[1] = 1;
    for (int i = 2; i <= n; i++) {
      for (int j = 0; j < factor[i].size(); j++) {
        int s = factor[i][j];
        if (a[i] > a[s] && i > s) dp[i] = max(dp[i], dp[s] + 1);
      }
    }
    printf("%d\n", *max_element(dp + 1, dp + n + 1));
  }
}
