#include <bits/stdc++.h>
using namespace std;
long long n, t, a[200200], c[200200], z = 1;
vector<long long> v;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
      c[i] = 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = i + i; j <= n; j += i) {
        if (a[j] > a[i]) {
          c[j] = max(c[j], c[i] + 1);
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      z = max(z, c[i]);
    }
    cout << z << endl;
    z = 0;
  }
  return 0;
}
