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