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