#include <bits/stdc++.h>
using namespace std;
int arr[1000005], n, dp[1000005];
int rec(int x) {
  int i, j, k;
  if (dp[x] != -1) return dp[x];
  for (i = 2;; i++) {
    if (x * i > n) break;
    if (arr[x * i] > arr[x]) dp[x] = max(dp[x], rec(x * i) + 1);
  }
  if (dp[x] < 0) dp[x] = 1;
  return dp[x];
}
int main() {
  int t, z;
  cin >> t;
  while (t--) {
    memset(dp, -1, sizeof dp);
    cin >> n;
    int i, j, k, l, MX = 0;
    for (i = 1; i <= n; i++) cin >> arr[i];
    for (i = 1; i <= n; i++) {
      if (dp[i] != -1)
        MX = max(MX, dp[i]);
      else
        MX = max(MX, rec(i));
    }
    cout << MX << endl;
  }
  return 0;
}
