#include <bits/stdc++.h>
using namespace std;
const long long N = 2000005;
const long long mod = 1000000007;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n + 1);
    for (long long i = 1; i <= n; i++) cin >> a[i];
    vector<long long> dp(n + 1);
    for (long long i = 1; 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 (a[i] < a[j]) dp[j] = max(dp[j], dp[i] + 1);
    long long ans = 0;
    for (long long i = 1; i <= n; i++) ans = max(dp[i], ans);
    cout << ans << endl;
  }
  return 0;
}
