#include <bits/stdc++.h>
using namespace std;
int cases = 1;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n + 1, 0);
    for (int i = 1; i <= n; i++) cin >> v[i];
    int maxi = 0;
    vector<int> ase(n + 1, 0);
    for (int i = n; i >= 1; i--) {
      ase[i]++;
      int mx = 0;
      for (int j = i + i; j <= n; j += i) {
        if (v[j] > v[i]) mx = max(ase[j], mx);
      }
      ase[i] += mx;
      maxi = max(ase[i], maxi);
    }
    cout << maxi << endl;
  }
}
