#include <bits/stdc++.h>
using namespace std;
void TESTCASE() {
  long long int n;
  cin >> n;
  vector<long long int> s(n + 1);
  for (long long int i = 1; i <= n; i++) cin >> s[i];
  vector<long long int> dp(n + 1, 1);
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 2 * i; j <= n; j += i) {
      if (s[j] > s[i]) {
        dp[j] = max(dp[j], dp[i] + 1);
      }
    }
  }
  long long int res = *max_element(dp.begin() + 1, dp.end());
  cout << res << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long int TEST;
  cin >> TEST;
  while (TEST--) {
    TESTCASE();
  }
  return 0;
}
