#include <bits/stdc++.h>
using namespace std;
int main() {
  int t_;
  cin >> t_;
  while (t_--) {
    long long n;
    cin >> n;
    vector<long long> s(n);
    for (long long i = 0; i < n; i++) {
      cin >> s[i];
    }
    vector<long long> x(n, 0);
    x[0] = 1;
    for (long long i = 2; i <= n; i++) {
      long long best = 0;
      for (long long j = 1; j * j <= i; j++) {
        if (i % j == 0) {
          if (x[j - 1] > best && s[j - 1] < s[i - 1]) {
            best = x[j - 1];
          }
          if (x[(i / j) - 1] > best && s[(i / j) - 1] < s[i - 1]) {
            best = x[(i / j) - 1];
          }
        }
      }
      x[i - 1] = best + 1;
    }
    long long best = 0;
    for (long long i = 0; i < n; i++) {
      best = max(best, x[i]);
    }
    cout << best << endl;
  }
  return 0;
}
