#include <bits/stdc++.h>
using namespace std;
vector<long long> divisors[100005];
long long ans[100005];
long long ara[100005];
void refresh() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1, i, j;
  cin >> t;
  for (i = 1; i <= 100000; i++) {
    for (j = i; j <= 100000; j += i) {
      divisors[j].push_back(i);
    }
  }
  while (t--) {
    refresh();
    long long n;
    cin >> n;
    for (i = 1; i <= n; i++) {
      cin >> ara[i];
      ans[i] = 1;
    }
    ans[1] = 1;
    long long fin = 1;
    for (i = 1; i <= n; i++) {
      for (j = 0; j < divisors[i].size(); j++) {
        long long x = divisors[i][j];
        if (ara[x] < ara[i]) {
          ans[i] = max(ans[i], ans[x] + 1);
        }
      }
      fin = max(ans[i], fin);
    }
    cout << fin << endl;
  }
  return 0;
}
