T=int(input()) answers=[] for _ in range(T): x1,y1,x2,y2,X1,Y1,X2,Y2=map(int,input().split()) s=(X1-x1)*(y2-x1)-(x2-x1)*(Y1-y1) t=(X1-x2)*(Y2-y1)-(X2-x1)*(Y1-y1) if(s*t<=0): answers.append("No") else: answers.append("Yes") for ans in answers: print(ans)