#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
using pii = pair<int, int>;
const int MOD = 1e9 + 7, N = 2e3 + 10;
void sol() {
  long long n;
  cin >> n;
  vector<long long> a(n + 1);
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  vector<long long> ans(n + 1, 1);
  for (int i = n / 2; i >= 1; i--) {
    int j = 2;
    while (i * j <= n) {
      if (ans[j * i] + 1 > ans[i] && a[i] < a[j * i]) ans[i] = ans[i * j] + 1;
      j++;
    }
  }
  long long mx = 0;
  for (int i = 1; i <= n; i++) {
    mx = max(mx, ans[i]);
  }
  cout << mx;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    sol();
    cout << endl;
  }
}
