#include <bits/stdc++.h>
using namespace std;
long long exp(long long n, long long m, long long md) {
  long long a = 1;
  while (m > 0) {
    if (m & 1) a = (a * n % md) % md;
    m /= 2;
    n = (n * n) % md;
  }
  return a % md;
}
void disp(vector<long long> v) {
  for (auto u : v) cout << u << " ";
  cout << "\n";
}
long long gcd2(long long a, long long b) { return b ? gcd2(b, a % b) : a; }
bool naiveprime(long long n) {
  if (n < 2) return false;
  for (long long x = 2; x * x <= n; x++) {
    if (n % x == 0) return false;
  }
  return true;
}
bool check_composite_for_prime_function(long long n, long long a, long long d,
                                        int s) {
  long long x = exp(a, d, n);
  if (x == 1 || x == n - 1) return false;
  for (int r = 1; r < s; ++r) {
    x = x * x % n;
    x %= n;
    if (x == n - 1) return false;
  }
  return true;
}
bool prime(long long n, int iter = 5) {
  if (n < 4) return n == 2 || n == 3;
  if (!(n & 1)) return false;
  int s = 0;
  long long d = n - 1;
  while (!(d & 1)) {
    d >>= 1;
    s++;
  }
  for (int a : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}) {
    if (n == a) return true;
    if (check_composite_for_prime_function(n, a, d, s)) return false;
  }
  return true;
}
const int NPR = 10000000;
int lp[NPR + 1];
vector<int> pr;
void prfac(int n = NPR) {
  if (n > NPR) return;
  long long i;
  for (i = 0; i < n + 5; i++) lp[i] = 0;
  for (i = 2; i <= n; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i]; ++j) {
      long long a = i * pr[j];
      if (a <= n) lp[a] = pr[j];
    }
  }
}
long long a[100001];
void go1() {
  long long n;
  cin >> n;
  long long i, j, k;
  for (i = 1; i < n + 1; i++) cin >> a[i];
  long long ans[n + 1];
  ans[n] = 1;
  long long mxx = 1;
  for (i = n - 1; i >= 1; i--) {
    ans[i] = 1;
    j = 2;
    long long mx = 0;
    while (j * i <= n) {
      if (a[j * i] > a[i]) {
        if (mx < ans[j * i]) mx = ans[j * i];
      }
      j++;
    }
    ans[i] += mx;
    if (mxx < ans[i]) mxx = ans[i];
  }
  cout << mxx << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  chrono::high_resolution_clock::time_point start =
      chrono::high_resolution_clock::now();
  long long tt = 1;
  cin >> tt;
  long long t = tt;
  cout << fixed << setprecision(10);
  while (tt--) {
    go1();
  }
  chrono::high_resolution_clock::time_point end =
      chrono::high_resolution_clock::now();
  long double time_spent =
      (chrono::duration_cast<chrono::duration<long double> >(end - start))
          .count();
  cerr << time_spent << '\n';
  return 0;
}
