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