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