#include <bits/stdc++.h>
using namespace std;
class comp {
 public:
  bool operator()(int& a, int& b) { return a > b; }
};
bool comp1(pair<int, int> a, pair<int, int> b) { return (a.second < b.second); }
void solve() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n + 1);
    for (int i = 1; i <= n; i++) {
      cin >> v[i];
    }
    vector<int> dp(n + 1, 1);
    for (int i = 1; i <= n; i++) {
      for (int j = 2 * i; j <= n; j += i) {
        if (v[i] < v[j]) {
          dp[j] = max(dp[i] + 1, dp[j]);
        }
      }
    }
    int res = INT32_MIN;
    for (int i = 1; i <= n; i++) {
      res = max(res, dp[i]);
    }
    cout << res << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
