#include <bits/stdc++.h>
int main() {
  int t, n, i, j, m, s[100007], a[100007];
  for (scanf("%d", &t); t--;) {
    for (scanf("%d", &n), i = 0; i++ < n;) scanf("%d", a + i), s[i] = 1;
    for (i = 1; i < n; i++)
      for (j = i; j <= n; j += i)
        if (a[j] > a[i]) s[j] = std::max(s[j], s[i] + 1);
    for (i = m = 0; i++ < n;) m = std::max(m, s[i]);
    printf("%d\n", m);
  }
  return 0;
}
