#include <bits/stdc++.h>
using namespace std;
void yes() { cout << "YES" << endl; }
void no() { cout << "NO" << endl; }
const int N = 5 * 1e5 + 11;
int n, k, a[N], d[N], cnt[N];
long long ans;
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[i] = 0;
    d[i] = 0;
  }
  int mx = 0;
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= sqrt(i) + 1; j++) {
      if (i % j == 0) {
        if (a[i] > a[j]) {
          cnt[j] = max(cnt[j], cnt[i] + 1);
        }
        if (j == 1) continue;
        int df = i / j;
        if (a[i] > a[df]) {
          cnt[df] = max(cnt[df], cnt[i] + 1);
        }
      }
    }
    mx = max(mx, cnt[i]);
  }
  cout << mx + 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
