#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n + 1], dp[n + 1];
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) dp[i] = 1;
    dp[1] = 1;
    for (int i = 1; i <= n; i++) {
      for (int j = 2 * i; j <= n; j += i)
        if (a[j] > a[i]) dp[j] = max(dp[j], dp[i] + 1);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, dp[i]);
    cout << ans << '\n';
  }
}
