#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, s = 0, l, t;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    long long a[n + 5], b[n + 5];
    memset(b, 0, sizeof(b));
    for (i = 1; i <= n; i++) cin >> a[i];
    long long mn = 1;
    for (i = 1; i <= n; i++) {
      if (b[i] == 0) b[i] = 1;
      for (j = 2 * i; j <= n; j += i) {
        if (a[j] > a[i]) {
          b[j] = max(b[j], b[i] + 1);
          mn = max(mn, b[j]);
        }
      }
    }
    cout << mn << endl;
  }
  return 0;
}
