#include <bits/stdc++.h>
using namespace std;
long long const mod = 1000000000 + 7;
long long sgn(long long a) {
  if (a > 0)
    return 1;
  else
    return -1;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n + 1);
    vector<long long> f(n + 1, 1);
    for (long long i = 1; i <= n; ++i) cin >> v[i];
    for (long long i = 1; i <= n; i++) {
      for (long long j = i * 2; j <= n; j += i) {
        if (v[i] < v[j]) f[j] = max(f[j], f[i] + 1);
      }
    }
    long long ans = 0;
    for (long long i = 1; i <= n; ++i) ans = max(ans, f[i]);
    cout << ans << "\n";
  }
  return 0;
}
