#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int tt, n, ans;
  cin >> tt;
  while (tt--) {
    cin >> n;
    vector<int> v(n + 1), cnt(n + 1, 1);
    for (int i = 1; i <= n; i++) cin >> v[i];
    ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + i; j <= n; j += i) {
        if (v[i] < v[j]) cnt[j] = max(cnt[j], cnt[i] + 1);
      }
      ans = max(ans, cnt[i]);
    }
    cout << ans << '\n';
  }
  return 0;
}
