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