import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes") no = lambda :print("no");No = lambda :print("No") ####################################################################### t = ni() assert 1 <= t <= 100 for _ in range(t): x1,y1,x2,y2,X1,Y1,X2,Y2 = na() assert 0 <= x1 <= 10**9 assert 0 <= x2 <= 10**9 assert 0 <= y1 <= 10**9 assert 0 <= y2 <= 10**9 assert 0 <= X1 <= 10**9 assert 0 <= X2 <= 10**9 assert 0 <= Y1 <= 10**9 assert 0 <= Y2 <= 10**9 assert (x1, y1) != (x2, y2) assert (X1, Y1) != (X2, Y2)