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