#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printer(char *name, T value) {
  cout << "name: " << name << "\tvalue: " << value << "\n";
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  cin >> T;
  long long n, a1, an, t;
  long long dp[100005], v[100005];
  while (T--) {
    cin >> n;
    for (long long i = 0; i < n; i++) {
      cin >> v[i + 1];
      dp[i + 1] = 1;
    }
    for (long long m = 1; m < n; m++) {
      for (long long j = 2; j < (n / m) + 1; j++) {
        if (v[m] < v[m * j]) dp[m * j] = max(dp[m * j], dp[m] + 1);
      }
    }
    cout << *max_element(dp + 1, dp + n + 1) << "\n";
  }
  return 0;
}
