#include <bits/stdc++.h>
using namespace std;
int t, i, j, k, v[100008], n, contmax, lis[100005];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (i = 1; i <= n; i++) cin >> v[i];
    contmax = 1;
    for (i = n; i >= 1; i--) {
      lis[i] = 1;
      for (j = i + i; j <= n; j = j + i)
        if (v[i] < v[j])
          lis[i] = max(lis[i], lis[j] + 1), contmax = max(contmax, lis[i]);
    }
    cout << contmax << '\n';
  }
  return 0;
}
