#include <bits/stdc++.h>
using namespace std;
int a[100005];
int dp[100005];
long long PowerMod(long long a, long long b, long long c) {
  int ans = 1;
  a = a % c;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % c;
    b = b / 2;
    a = (a * a) % c;
  }
  return ans;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      dp[i] = 1;
    }
    int ans = 0;
    long long p = PowerMod(20, 20, 3);
    for (int i = 1; i <= n; i++) {
      for (int j = i + i; j <= n; j += i) {
        if (a[i] < a[j]) {
          dp[j] = max(dp[j], dp[i] + 1);
        }
      }
      ans = max(dp[i], ans);
    }
    printf("%d\n", ans);
  }
}
