#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
using namespace std;
int ret(int *a, int n) {
  int lis[n + 1];
  for (int i = 1; i <= n; i++) lis[i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = i * 2; j <= n; j += i) {
      if (a[j] > a[i] && lis[j] < lis[i] + 1) lis[j] = lis[i] + 1;
    }
  }
  return *max_element(lis + 1, lis + n + 1);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n + 1];
    for (int i = 1; i <= n; i++) cin >> a[i];
    cout << ret(a, n) << '\n';
  }
  return 0;
}
