#include <bits/stdc++.h>
using namespace std;
long long int binary_expo(long long int base, long long int pw) {
  long long int res = 1;
  while (pw) {
    if (pw % 2) {
      res *= base;
      res %= 1000000007;
      pw -= 1;
    } else {
      base *= base;
      base %= 1000000007;
      pw /= 2;
    }
  }
  return res;
}
long long int mod_inv(long long int k) {
  return binary_expo(k, 1000000007 - 2);
}
int t, n;
vector<long long int> s(100005, 0);
long long int dp[100005];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    s.clear();
    for (int i = 1; i <= n; i++) dp[i] = 1;
    for (int i = 1; i <= n; i++) cin >> s[i];
    long long int ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 2 * i; j <= n; j += i) {
        if (s[j] > s[i]) {
          dp[j] = max(dp[j], dp[i] + 1);
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      ans = max(ans, dp[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
