#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int t;
int n, ans[N], mx, a[N];
void solve() {
  mx = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        if (a[i] > a[j]) ans[i] = max(ans[i], ans[j]);
        if (a[i] > a[i / j]) ans[i] = max(ans[i], ans[i / j]);
      }
    }
    ans[i]++;
    mx = max(mx, ans[i]);
  }
  cout << mx << endl;
}
int main() {
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
