#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long int a[n + 1];
    vector<long long int> v(n + 1, 1);
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
      for (int j = i * 2; j <= n; j += i)
        if (a[i] < a[j]) v[j] = max(v[j], v[i] + 1);
    }
    auto it = max_element(v.begin(), v.end());
    cout << *it << '\n';
  }
  return 0;
}
