#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cout << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
using ll = long long;
using ld = long double;
const ll MOD = 1e9l + 7;
const ll INF = 1e18l + 5;
inline ll add(ll a, ll b) { return (a % MOD + b % MOD) % MOD; }
inline ll sub(ll a, ll b) { return (a % MOD - b % MOD + MOD) % MOD; }
inline ll mult(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
inline ll power(ll a, ll b) {
  a %= MOD;
  ll r = 1;
  while (b) {
    if (b & 1) r = mult(r, a);
    a = mult(a, a);
    b >>= 1;
  }
  return r;
}
vector<ll> a(100010);
vector<ll> dp(100010);
ll n;
ll func(ll ind) {
  if (dp[ind] != -1) return dp[ind];
  if (ind > n) return 0;
  ll ma = 0;
  for (ll i = 2 * ind; i <= n; i += ind) {
    if (a[i] > a[ind]) ma = max(ma, 1 + func(i));
  }
  return dp[ind] = ma;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed;
  ll t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (ll i = 1; i <= n; ++i) {
      cin >> a[i];
      dp[i] = -1;
    }
    ll ma = 1;
    for (ll i = 1; i <= n; ++i) {
      ma = max(ma, 1 + func(i));
    }
    cout << ma << '\n';
  }
  return 0;
}
