#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
const double PI = acos(-1.0);
int a[mx], dp[mx];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int ans = 1;
    for (int i = 1; i <= n; i++) {
      dp[i] = 1;
      for (int j = 1; j <= sqrt(i); j++) {
        if (i % j == 0) {
          int x = j, y = i / j;
          if (a[i] > a[x] && i != x) dp[i] = max(dp[i], dp[x] + 1);
          if (a[i] > a[y] && i != y) dp[i] = max(dp[i], dp[y] + 1);
          ans = max(ans, dp[i]);
        }
      }
    }
    for (int i = 1; i <= n; i++) dp[i] = 0;
    printf("%d\n", ans);
  }
  return 0;
}
