#include <bits/stdc++.h>
using namespace std;
ofstream g("date.out");
int t;
vector<int> diviz[100005];
int main() {
  cin >> t;
  for (int i = 1; i <= 100000; i++) {
    for (int j = 2 * i; j <= 100000; j += i) {
      diviz[j].push_back(i);
    }
  }
  while (t--) {
    int n, sol = 0;
    cin >> n;
    vector<int> v(n + 5, 0);
    vector<int> dp(n + 5, 0);
    for (int i = 1; i <= n; i++) {
      cin >> v[i];
      dp[i] = 1;
      for (int j = 0; j < diviz[i].size(); j++) {
        int val = diviz[i][j];
        if (v[i] > v[val]) {
          dp[i] = max(dp[i], dp[val] + 1);
        }
      }
      sol = max(sol, dp[i]);
    }
    cout << sol << '\n';
  }
}
