#include <bits/stdc++.h>
using namespace std;
int dp[100004];
int n;
int a[100004];
int func(int ind) {
  if (ind > n) return 0;
  if (dp[ind] != -1) return dp[ind];
  int count = 0;
  for (int i = 2 * ind; i <= n; i += ind) {
    if (a[i] > a[ind]) count = max(count, 1 + func(i));
  }
  return dp[ind] = count;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i < n + 1; i++) {
      cin >> a[i];
      dp[i] = -1;
    }
    int maxi = 1;
    for (int i = 1; i < n + 1; i++) {
      maxi = max(maxi, 1 + func(i));
    }
    cout << maxi << endl;
  }
  return 0;
}
