#!/usr/bin/env python def ChkKado(x, y, z): if x != y != z != x: if x > y < z or x < y > z: return True return False def MkRange1(d0, dt): tmax = float('inf') tmin = 0.0 if dt == 0: if d0 <= 0: tmax = -1 elif dt > 0: tmin = max(0.0, -d0/dt) elif dt < 0: tmax = -d0/dt return [tmin, tmax] def MkRange2(d0, dt): tmax = float('inf') tmin = 0.0 if dt == 0: if d0 >= 0: tmax = -1 elif dt > 0: tmax = -d0/dt elif dt < 0: tmin = max(0.0, -d0/dt) return [tmin, tmax] def ChkAbKado(x0, y0, z0, xt, yt, zt): dyx = [y0 - x0, yt - xt] dyz = [y0 - z0, yt - zt] dzx = [z0 - x0, zt - xt] yxrange1 = MkRange1(*dyx) yzrange1 = MkRange1(*dyz) yxrange2 = MkRange2(*dyx) yzrange2 = MkRange2(*dyz) if dzx == [0.0, 0.0]: return False elif max(yxrange1[0], yzrange1[0], 0.0) < min(yxrange1[1], yzrange1[1]): return True elif max(yxrange2[0], yzrange2[0], 0.0) < min(yxrange2[1], yzrange2[1]): return True else: return False N = int(input()) tcases = [] for i in range(N): tcases.append([int(x) for x in input().split()]) for tcase in tcases: if ChkKado(*tcase[:3]): print('YES') elif ChkAbKado(*tcase): print('YES') else: print('NO')