#include <bits/stdc++.h>
using namespace std;
int binpow(int a, int n) {
  if (n == 0) return 1;
  if (n & 1) {
    return binpow(a, n - 1) * a;
  }
  int b = binpow(a, n / 2);
  return b * b;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n + 1), dp(n + 1, 1);
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    dp[1] = 1;
    for (int i = 2; i <= n; i++) {
      for (int j = 1; j * j <= i; j++) {
        if (!(i % j)) {
          if (a[j] < a[i]) dp[i] = max(dp[i], dp[j] + 1);
          if (a[i / j] < a[i]) dp[i] = max(dp[i], dp[i / j] + 1);
        }
      }
    }
    int ans = 1;
    for (int i = 1; i <= n; i++) {
      ans = max(ans, dp[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
