#include <bits/stdc++.h>
using namespace std;
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
long long n;
vector<long long> v(1000002);
long long dp[1000005];
long long check(long long i) {
  long long cnt = 0;
  if (i > n) return 0;
  if (dp[i] != -1) return dp[i];
  for (long long j = 2 * i; j <= n; j += i) {
    if (v[j] > v[i]) cnt = max(cnt, 1 + check(j));
  }
  return dp[i] = cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long tc = 1, i, j, k;
  cin >> tc;
  while (tc--) {
    cin >> n;
    for (long long i = 1; i <= n; i++) cin >> v[i];
    long long ans = 1;
    for (long long i = 1; i <= 1000004; i++) dp[i] = -1;
    for (long long i = 1; i <= n; i++) {
      ans = max(ans, 1 + check(i));
    }
    cout << ans << endl;
  }
}
