#include <bits/stdc++.h>
using namespace std;
vector<int> divisors[100002];
void solve() {
  int n;
  cin >> n;
  vector<int> v(n + 2);
  for (int i = 0; i < n; i++) {
    cin >> v[i + 1];
  }
  v[0] = 1e9 + 3;
  int ans = 1;
  vector<int> dp(n + 2, 0);
  dp[1] = 1;
  for (int i = 2; i <= n; i++) {
    dp[i] = 1;
    for (int d : divisors[i]) {
      if (v[i] > v[d]) {
        dp[i] = max(dp[i], dp[d] + 1);
      }
    }
    ans = max(dp[i], ans);
  }
  cout << ans << endl;
}
void sieve(int n) {
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = i * 2; j <= n; j += i) {
      divisors[j].push_back(i);
    }
  }
}
int main() {
  int t = 1;
  sieve(1e5 + 1);
  cin >> t;
  while (t--) solve();
}
