#include <bits/stdc++.h>
using namespace std;
int t, n, a[100005];
vector<int> v[100005];
int val[100005];
int k[100005];
int main() {
  for (int i = 2; i <= 100000; i++) {
    v[i].push_back(1);
    for (int j = i + i; j <= 100000; j += i) {
      v[j].push_back(i);
    }
  }
  scanf("%d", &t);
  while (t--) {
    memset(k, 0, sizeof(k));
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = n; i >= 1; i--) {
      if (k[i] == 0) k[i] = 1;
      int p = v[i].size();
      for (int j = 0; j < p; j++) {
        if (a[i] > a[v[i][j]]) k[v[i][j]] = max(k[v[i][j]], k[i] + 1);
      }
    }
    int mx = 0;
    for (int i = 1; i <= n; i++) {
      mx = max(mx, k[i]);
    }
    printf("%d\n", mx);
  }
  return 0;
}
