#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
signed main() {
  fastio();
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    vector<long long> s(n);
    for (long long i = 0; i < n; i++) cin >> s[i];
    vector<long long> m(n, 1);
    long long ans = 1;
    for (long long i = 1; i <= n; i++) {
      long long j = 2 * i;
      while (j <= n) {
        if (s[j - 1] > s[i - 1]) m[j - 1] = max(m[j - 1], m[i - 1] + 1);
        j += i;
      }
      ans = max(ans, m[i - 1]);
    }
    cout << ans << '\n';
  }
  return 0;
}
