#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int ar[n + 1];
    for (int i = 1; i <= n; i++) {
      cin >> ar[i];
    }
    int dp[n + 1];
    for (int i = 1; i <= n; i++) {
      dp[i] = 0;
    }
    for (int i = n / 2; i >= 1; i--) {
      for (int j = 2 * i; j <= n; j += i) {
        if (ar[j] > ar[i]) {
          dp[i] = max(dp[j] + 1, dp[i]);
        }
      }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      ans = max(ans, dp[i]);
    }
    cout << ans + 1 << endl;
  }
  return 0;
}
