#include <bits/stdc++.h>
using namespace std;
const long long mod = (1e9) + 7;
const double pi = acos(-1);
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void solve() {
  int n, i, j, a[100005];
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int ans = 1;
  vector<int> dp(n + 1, 0);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= sqrt(i); j++) {
      if (i % j == 0) {
        if (a[i] > a[j]) {
          dp[i] = max(dp[j] + 1, dp[i]);
        }
        if (a[i] > a[i / j]) {
          dp[i] = max(dp[i / j] + 1, dp[i]);
        }
      }
    }
    if (dp[i] == 0) dp[i] = 1;
    ans = max(ans, dp[i]);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
