#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
bool sortcol(const vector<int>& v1, const vector<int>& v2) {
  return v1[1] < v2[1];
}
long long int mod_pow(int a, int b, int M = MOD) {
  int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
long long int ncr(long long int n, long long int r) {
  if (n == 1 || r == 0) return 1;
  if (r > n / 2) r = n - r;
  long long int ans = 1;
  for (long long int i = 1; i <= r; i++) {
    ans = ((ans * n) / i);
    n--;
  }
  return ans;
}
long long int ncrsum(long long int n, long long int r, long long int mod) {
  if (n == 1 || r == 0) return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i1, i2, k, m, j, j1, a1, f, i31, i3, j2, i5, i4, i6, i7, i;
    long long int x, y;
    long long int total = 0, cnt = 0;
    long long int flag = 0;
    y = 0;
    long long int res, res1, ans, res2, q;
    ans = 0;
    res1 = 0, res = 0;
    long long int s1, s2, s3;
    s2 = 0;
    long long int sum = 0;
    s1 = 0;
    long long int k1, k2, k3, d;
    string s;
    vector<long long int> v;
    cin >> n;
    long long int arr[n + 1];
    for (i = 1; i <= n; i++) cin >> arr[i];
    if (n == 1) {
      cout << 1 << "\n";
      continue;
    }
    vector<long long int> dpp(n + 1, 1);
    for (i = 1; i <= n; i++) {
      for (j = 1; j * j <= i; j++) {
        if (i % j == 0) {
          if (arr[j] < arr[i]) dpp[i] = max(dpp[i], 1 + dpp[j]);
          if (arr[i / j] < arr[i]) dpp[i] = max(dpp[i], 1 + dpp[i / j]);
        }
      }
      ans = max(ans, dpp[i]);
    }
    cout << ans << "\n";
  }
}
