#include <bits/stdc++.h>
using namespace std;
int static fast = []() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  return 0;
}();
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<long long> arr(n, 0);
    vector<long long> dp(n + 1, 1);
    for (auto& val : arr) cin >> val;
    long long ans = 1;
    for (long long i = 1; i <= n / 2; i++) {
      for (long long j = i * 2; j <= n; j += i) {
        if (arr[j - 1] > arr[i - 1]) {
          dp[j] = max(dp[j], dp[i] + 1);
          ans = max(ans, dp[j]);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
