#include #include #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) typedef long long LL; using namespace::std; #define H 101 const LL INF = (LL)1e10+10; LL N,A[H],B[H],L[H],R[H],dd[H][H]; void M(LL* a,LL* dp){ fill(dp, dp + H, INF); rep(i,H)rep(j,H)dd[i][j] = j>1?INF:0; LL sa; rep(i,N){ dp[i] = 1; rep(j,i){ if( a[j] < a[i] ){ sa = a[i]-a[j]; for(int k=1; k<=dp[j];++k){ if( sa > dd[j][ k ] ){ if( dp[i] < k + 1 ){ dp[i] = k + 1; } dd[i][k+1] = min( dd[i][k+1], sa ); } } } } } return ; } int main(void){ LL T,X; cin>>T; rep(i,T){ cin>>N; X = 0; rep(j,N){ cin>>A[j]; B[N-j-1] = A[j]; } M(A,L); M(B,R); rep(k,N){ X = max( X,L[k] + R[N-1-k] -1); } cout<