#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, q;
  scanf("%d", &t);
  for (q = 1; q <= t; q++) {
    long long int n, i;
    cin >> n;
    long long int ar[n + 5];
    long long int vis[n + 2];
    for (i = 1; i <= n; i++) {
      cin >> ar[i];
      vis[i] = 1;
    }
    long long int ans = 1, c, k;
    long long int tem, tem2;
    for (int i = 1; i <= n; i++) {
      k = i;
      for (int j = i * 2; j <= n; j = j + i) {
        if (ar[i] < ar[j]) {
          vis[j] = max(vis[j], vis[i] + 1);
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      ans = max(ans, vis[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
