var t,l,i,j,n,high,low,mid,maxlis:longint; a,awf,lis:array[0..100050] of longint; begin readln(t); for l:=1 to t do begin fillchar(a,sizeof(a),0); readln(n); for i:=1 to n do read(a[i]); readln; fillchar(awf,sizeof(awf),0); fillchar(lis,sizeof(lis),0); lis[1]:=1; maxlis:=1; awf[0]:=-1; awf[1]:=a[1]; for i:=2 to n do begin if (a[i]>awf[maxlis]) then begin lis[i]:=maxlis+1; awf[lis[i]]:=a[i]; end else begin low:=0; high:=maxlis; while (lowawf[mid]) then low:=mid else high:=mid; end; awf[low+1]:=a[i]; lis[i]:=low+1; end; if (maxlis