#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
int n, a[MAXN], f[MAXN];
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) f[i] = 1;
    for (int i = 1; i <= n; i++)
      for (int j = i * 2; j <= n; j += i)
        if (a[i] < a[j]) f[j] = max(f[j], f[i] + 1);
    int ans = 0;
    for (int i = 1; i <= n; i++) ans = max(ans, f[i]);
    cout << ans << endl;
  }
  return 0;
}
