#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<int> b(n + 1, 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        if (a[i] > a[j]) {
          sum = max(sum, b[j]);
        }
        if (a[i] > a[i / j]) {
          sum = max(sum, b[i / j]);
        }
      }
    }
    b[i] = sum + 1;
    ans = max(ans, b[i]);
  }
  cout << ans << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
