#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, s[100005], ans[100005], ma = 1;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    for (int j = 0; j < 100005; j++) ans[j] = 1;
    for (int j = 0; j < n; j++) cin >> s[j];
    for (int j = n / 2; j > 0; j--) {
      for (int k = j * 2; k <= n; k += j) {
        if (s[k - 1] > s[j - 1]) {
          ans[j - 1] = max(ans[j - 1], ans[k - 1] + 1);
        }
      }
      ma = max(ma, ans[j - 1]);
    }
    cout << ma << '\n';
    ma = 1;
  }
}
