#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long b[n + 1];
    for (long long i = 0; i <= n; i++) {
      b[i] = 1;
    }
    for (long long i = 1; i < n; i++) {
      for (long long j = 1; j <= sqrt(i + 1); j++) {
        if ((i + 1) % j == 0) {
          if (a[j - 1] < a[i]) {
            b[i + 1] = max(b[i + 1], b[j] + 1);
          }
          long long d = (i + 1) / j;
          if (a[d - 1] < a[i]) {
            b[i + 1] = max(b[i + 1], b[d] + 1);
          }
        }
      }
    }
    long long maxi = 0;
    for (long long i = 1; i <= n; i++) {
      maxi = max(maxi, b[i]);
    }
    cout << maxi << "\n";
  }
}
