#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = numeric_limits<long long>::max() / 4;
constexpr long long n_max = 2e5 + 10;
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char c) { return to_string((string)&c); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) res += ", ";
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long t;
  cin >> t;
  for (long long _ = 0; _ < (long long)(t); _++) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < (long long)(n); i++) cin >> a[i];
    vector<long long> dp(n + 1);
    for (long long i = 1; i < (long long)(n) + 1; i++) {
      dp[i]++;
      for (long long j = i * 2; j <= n; j += i) {
        if (a[j - 1] > a[i - 1]) chmax(dp[j], dp[i]);
      }
    }
    long long ans = 0;
    for (long long i = 0; i < (long long)(n + 1); i++) chmax(ans, dp[i]);
    cout << ans << "\n";
  }
}
