#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int MOD = (int)998244353;
const int INF = (int)1e18;
bool cmp(const pair<long long, long long>& a,
         const pair<long long, long long>& b) {
  return a.second < b.second;
}
void solve() {
  long long n, mx = 0;
  cin >> n;
  long long a[n + 1], b[n + 1];
  for (long long i = 1; i < n + 1; i++) {
    cin >> a[i], b[i] = 1;
  }
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 2 * i; j <= n; j += i) {
      if (a[j] > a[i]) {
        b[j] = max(b[j], b[i] + 1);
      }
    }
  }
  for (long long i = 1; i < n + 1; i++) mx = max(mx, b[i]);
  cout << mx << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1, m = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
