def gcd(a,b): while b!=0: r=a%b a,b=b,r return abs(a) def max_min_cross(p1, p2, p3, p4): min_ab, max_ab = min(p1, p2), max(p1, p2) min_cd, max_cd = min(p3, p4), max(p3, p4) if min_ab > max_cd or max_ab < min_cd: return False return True def cross_judge(a, b, c, d): # x座標による判定 if not max_min_cross(a[0], b[0], c[0], d[0]): return False # y座標による判定 if not max_min_cross(a[1], b[1], c[1], d[1]): return False tc1 = (a[0] - b[0]) * (c[1] - a[1]) + (a[1] - b[1]) * (a[0] - c[0]) tc2 = (a[0] - b[0]) * (d[1] - a[1]) + (a[1] - b[1]) * (a[0] - d[0]) td1 = (c[0] - d[0]) * (a[1] - c[1]) + (c[1] - d[1]) * (c[0] - a[0]) td2 = (c[0] - d[0]) * (b[1] - c[1]) + (c[1] - d[1]) * (c[0] - b[0]) return tc1 * tc2 <= 0 and td1 * td2 <= 0 T=int(input()) for _ in range(T): x1,y1,x2,y2,X1,Y1,X2,Y2=list(map(int,input().split())) if cross_judge([x1,y1],[X1,Y1],[x2,y2],[X2,Y2]): print("No") continue diff_x1=x1-X1 diff_y1=y1-Y1 diff_x2=x2-X2 diff_y2=y2-Y2 g1=gcd(diff_x1,diff_y1) g2=gcd(diff_x2,diff_y2) diff_x1//=g1 diff_y1//=g1 diff_x2//=g2 diff_y2//=g2 if diff_x1==-diff_x2 and diff_y1==diff_y2:print("Yes") elif diff_x1==diff_x2 and diff_y1==-diff_y2:print("Yes") else:print("No")