//#include "debuge.cpp"
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
void solve() {
int n;
cin >> n;
vector<i64> a(n + 1);
for(int i = 1; i <= n; i++) cin >> a[i];
vector<i64> dp(n + 1, 1);
for(int i = 2; i <= n; i++) {
i64 mx = 1;
for(int j = 1; j * j <= n; j++) {
if(i % j ==0) {
if(a[i] > a[j]) mx = max(mx, dp[j] + 1);
if(a[i] > a[i / j]) mx = max(mx, dp[i / j] + 1);
}
}
dp[i] = mx;
}
cout << *max_element(dp.begin(), dp.end()) << '\n';
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
if(fopen("in", "r")) {
freopen("in", "r", stdin);
freopen("out", "w", stdout);
}
int tc;
cin >> tc;
while(tc--) solve();
}
1613B - Absent Remainder | 1536B - Prinzessin der Verurteilung |
1699B - Almost Ternary Matrix | 1545A - AquaMoon and Strange Sort |
538B - Quasi Binary | 424A - Squats |
1703A - YES or YES | 494A - Treasure |
48B - Land Lot | 835A - Key races |
1622C - Set or Decrease | 1682A - Palindromic Indices |
903C - Boxes Packing | 887A - Div 64 |
755B - PolandBall and Game | 808B - Average Sleep Time |
1515E - Phoenix and Computers | 1552B - Running for Gold |
994A - Fingerprints | 1221C - Perfect Team |
1709C - Recover an RBS | 378A - Playing with Dice |
248B - Chilly Willy | 1709B - Also Try Minecraft |
1418A - Buying Torches | 131C - The World is a Theatre |
1696A - NIT orz | 1178D - Prime Graph |
1711D - Rain | 534A - Exam |