import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines import numpy as np t=int(readline()) def solve(): n=int(readline()) a=list(map(int, readline().split())) dp=np.zeros((2, n, n), np.int16) ans=1 for i in range(n): for j in range(i): if a[j]a[i] and dp[1][j][i]==0: dp[1][j][i]=2 if ans0: for k in range(i+1, n): if a[i]-a[j]a[k] and dp[1][i][k]0: for k in range(i+1, n): if a[i]>a[k] and a[j]-a[i]>a[i]-a[k] and dp[1][i][k]