#include <bits/stdc++.h>
using namespace std;
vector<int> divs[100001];
void init() {
  for (int num = 2; num <= 100000; num++) {
    int limit = sqrt(num);
    divs[num].push_back(1);
    for (int div = 2; div <= limit; div++) {
      if (num % div == 0) {
        divs[num].push_back(div);
        divs[num].push_back(num / div);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  init();
  while (t--) {
    int n;
    cin >> n;
    long long arr[n + 1];
    for (int i = 1; i <= n; i++) {
      cin >> arr[i];
    }
    int cum[n + 1];
    int maxim = 0;
    for (int i = 1; i <= n; i++) {
      cum[i] = 1;
      int mx = 0;
      for (auto div : divs[i]) {
        if (arr[i] > arr[div]) {
          mx = max(mx, cum[div]);
        }
      }
      cum[i] += mx;
      maxim = max(maxim, cum[i]);
    }
    cout << maxim << endl;
  }
}
