#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int arr[n + 1];
    for (long long int i = 1; i <= n; i++) cin >> arr[i];
    long long int dp[n + 1];
    fill(dp, dp + n + 1, 1);
    for (long long int i = n / 2; i >= 1; i--) {
      for (long long int j = i + i; j <= n; j += i) {
        if (arr[j] > arr[i]) {
          dp[i] = max(dp[i], 1 + dp[j]);
        }
      }
    }
    long long int mx = 0;
    for (long long int i = 1; i <= n; i++) mx = max(dp[i], mx);
    cout << mx << endl;
  }
}
