#include <bits/stdc++.h>
using namespace std;
int nCr(int n, int r) {
  int res = 1;
  if (n < r) return -1;
  r = min(r, n - r);
  for (int i = 0; i < r; i++) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n + 1);
  for (int i = 0; i < n; i++) cin >> v[i + 1];
  vector<long long> a(n + 1, 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 2 * i; j <= n; j += i) {
      if (v[i] < v[j]) a[j] = max(a[j], a[i] + 1);
    }
  }
  cout << *max_element(a.begin(), a.end()) << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
