import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines import itertools t=int(readline()) def myon(a): INF=10**9+7 n=len(a) dp=[0]*n res=[1]*n for c in range(2, n+1): newdp=[INF]*n for i in range(n): ai=a[i] for j in range(i): aj=a[j] if dp[j]