#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  long long t = 1, n, m, i, j, k, u, to;
  cin >> t;
  long long tc = t;
  while (t--) {
    cin >> n;
    vector<long long> a(n + 1), dp(n + 1, 1);
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    long long ans = 1;
    for (i = n; i > 0; i--) {
      for (k = i; k <= n; k += i) {
        if (a[i] < a[k]) {
          dp[i] = max(dp[i], dp[k] + 1);
        }
        ans = max(ans, dp[i]);
      }
    }
    cout << ans << '\n';
  }
}
