t = int(input()) for _ in range(t): x1,y1,x2,y2,X1,Y1,X2,Y2 = list(map(int, input().split(' '))) if (y2-y1)*(X2-X1) == (Y2-Y1)*(x2-x1): min_x = min(x1,x2) max_x = max(x1,x2) MIN_X = min(X1,X2) MAX_X = max(X1,X2) # print(min_x,max_x,MIN_X,MAX_X) if max_x < MIN_X or MAX_X < min_x: print('No') else: print('Yes') else: print('No')