#include <bits/stdc++.h>
using namespace std;
int n, t, ans;
int num[1000005], f[1000005];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &num[i]);
      f[i] = 1;
    }
    ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i * 2; j <= n; j += i) {
        if (num[i] < num[j]) f[j] = max(f[j], f[i] + 1);
      }
      ans = max(ans, f[i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
