#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int64_t a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    int64_t dp[n];
    int64_t ans = 0;
    for (int i = n - 1; i >= 0; --i) {
      dp[i] = 1;
      for (int j = 2 * i + 1; j < n; ++j) {
        if (a[j] > a[i]) dp[i] = max(dp[i], dp[j] + 1);
        j += i;
      }
      ans = max(ans, dp[i]);
    }
    cout << ans << endl;
  }
}
