import itertools
n = int(input())
for _ in range(n):
    z='NO'
    q=list(map(int,input().split()))
    w=list(itertools.permutations(q))
    r=[]
    for i in w:
        k=True
        for e in range(1,len(i)-1):
            if i[e-1]+i[e+1]>=i[e]*2:
                r.append(True)
            else:
                r.append(False)
print(r)