#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    vector<int> dp(n + 1, 1);
    for (int i = n; i > 0; i--) {
      int count = 2;
      int j = i;
      while (j * count <= n) {
        if (a[i] < a[j * count]) dp[i] = max(dp[i], 1 + dp[j * count]);
        count++;
      }
    }
    int optimal = 1;
    for (int i = 1; i <= n; i++) {
      if (optimal < dp[i]) {
        optimal = dp[i];
      }
    }
    cout << optimal << endl;
  }
  return 0;
}
