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