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