#include <bits/stdc++.h>
using namespace std;
int T, n, s[100010], dist[100010], ans;
bool pr[100010];
vector<int> v;
void sieve() {
  memset(pr, true, sizeof(pr));
  v.clear();
  pr[1] = false;
  for (int i = 2; i <= 100000; i++) {
    if (pr[i]) {
      v.push_back(i);
      for (int j = i; j <= 100000 / i; j++) {
        pr[i * j] = false;
      }
    }
  }
}
int main() {
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
      dist[i] = 1;
    }
    ans = 1;
    for (int i = 1; i <= n; i++) {
      for (int x = 2; x * i <= n; x++) {
        int j = x * i;
        if (s[j] > s[i]) {
          dist[j] = max(dist[j], dist[i] + 1);
        }
      }
      ans = max(ans, dist[i]);
    }
    cout << ans << "\n";
  }
  return 0;
}
