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