#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void flush() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
}
int n;
int a[100009];
int dp[100009];
int solve(int i) {
  if (2 * i > n) return 0;
  if (dp[i] != -1) return dp[i];
  int r = 0;
  for (int j = 2 * i; j <= n; j += i) {
    if (a[j] > a[i]) r = max(r, solve(j) + 1);
  }
  return dp[i] = r;
}
int main() {
  flush();
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    memset(dp, -1, sizeof(dp));
    for (int i = 1; i <= n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, solve(i) + 1);
    cout << ans << endl;
  }
}
