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