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