#include <bits/stdc++.h>
using namespace std;
const long mod = 1e9 + 7;
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
bool cmp(pair<long long, long long> &a, pair<long long, long long> &b) {
  if (a.first == b.first) {
    return a.second < b.second;
  }
  return a.first < b.first;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n + 1);
  for (long long i = 0; i < n; i++) {
    int q;
    cin >> q;
    a[i + 1] = q;
  }
  vector<long long> ans(n + 1, 1);
  for (long long i = 1; i < n + 1; i++) {
    for (int j = 2 * i; j <= n; j += i) {
      if (a[j] > a[i]) {
        ans[j] = max(ans[j], ans[i] + 1);
      }
    }
  }
  cout << *max_element(ans.begin(), ans.end()) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  int i = 1;
  while (t--) {
    solve();
    i++;
  }
  return 0;
}
