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