#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], f[N];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, k;
    scanf("%d", &n);
    memset(a, 0, sizeof a);
    for (int i = 1; i <= n; i++) f[i] = 1;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++)
      for (int j = 2 * i; j <= n; j += i)
        if (a[i] < a[j]) f[j] = max(f[j], f[i] + 1);
    int res = 0;
    for (int i = 1; i <= n; i++) res = max(res, f[i]);
    printf("%d\n", res);
  }
  return 0;
}
