#include <bits/stdc++.h>
using namespace std;
double pi = 2 * acos(0.0);
const int INF = 1e9 + 7;
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long int a, long long int b) { return (a / gcd(a, b)) * b; }
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int nCrModp(long long int n, long long int r, long long int p) {
  if (r > n - r) r = n - r;
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (int j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
vector<bool> prime(10000009, true);
vector<int> listof;
void sieve() {
  prime[1] = false;
  for (int i = 2; i <= sqrt(1000009); i++) {
    if (prime[i] == true) {
      for (int j = i * i; j < 10000009; j += i) {
        prime[j] = false;
      }
    }
  }
  for (int i = 2; i < 10000009; i++) {
    if (prime[i] == true) {
      listof.push_back(i);
    }
  }
}
void WetPitch() {
  long long int n;
  vector<long long int> v(100005);
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    cin >> v[i];
  }
  long long int dp[100005];
  long long int ans = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 2 * i; j <= n; j += i) {
      if (v[i] < v[j]) {
        dp[j] = max(dp[j], dp[i] + 1);
      }
      ans = max(ans, dp[j]);
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int tst;
  tst = 1;
  cin >> tst;
  int p = 1;
  while (tst--) {
    WetPitch();
  }
  return 0;
}
