#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  int s[n + 1];
  for (int i = 1; i < n + 1; i++) {
    cin >> s[i];
  }
  int f[n + 1];
  for (int i = 0; i < n + 1; i++) {
    f[i] = 1;
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = 2 * i; j <= n; j += i) {
      if (s[j] > s[i]) {
        f[j] = max(f[j], f[i] + 1);
      }
    }
  }
  int mx = 0;
  for (int i = 1; i < n + 1; i++) {
    mx = max(mx, f[i]);
  }
  cout << mx << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
