#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9 + 7;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = ((res) * (x));
    res %= N;
    y = y >> 1;
    x = ((x) * (x));
  }
  return res;
}
long long powmod(long long a, long long b, long long n) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y) % n;
    }
    y = (y * y) % n;
    b /= 2;
  }
  return x % n;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> w(n + 1);
    w.push_back(0);
    for (long long i = 1; i <= n; i++) cin >> w[i];
    vector<long long> d(n + 1, 0);
    for (long long i = 1; i <= n; i++) {
      d[i] = 1;
      long long m = 0;
      for (long long j = 1; j <= sqrtl(i); j++) {
        if (i % j == 0 && w[i] > w[j]) m = max(d[j], m);
        if (i % j == 0 && w[i] > w[i / j]) m = max(d[i / j], m);
      }
      d[i] += m;
    }
    long long maxm = 0;
    for (auto x : d) maxm = max(maxm, x);
    cout << maxm << "\n";
  }
  return 0;
}
