import sys input = sys.stdin.readline N = int(input()) def check(x1, x2, y1, y2): return x1 == x2 and y1 == y2 def kadomatsu(a, b, c): if a == b or b == c or c == a: return False if a < b < c or a > b > c: return False return True for _ in range(N): x1, x2, x3, y1, y2, y3 = map(int, input().split()) if check(x1, x2, y1, y2) or check(x1, x3, y1, y3) or check(x3, x2, y3, y2): print("NO") continue if kadomatsu(x1, x2, x3) or kadomatsu(y1, y2, y3): print("YES") continue if x1 == x3: print("YES") continue if x1 == x2: x1, x3 = x3, x1 y1, y3 = y3, y1 if x2 == x3: if x1 < x2: if y2 > y3: print("YES") else: print("NO") else: if y2 < y3: print("YES") else: print("NO") else: if x1 > x2 > x3: x1, x3 = x3, x1 y1, y3 = y3, y1 if y2 == y3: if y1 <= y2: print("NO") else: print("YES") else: if y1 <= y2 <= y3: print("NO") else: if (y3 - y2) * x1 + (x2 - x3) * y1 > x2 * (y3 - y2) + (x2 - x3) * y2: print("YES") else: print("NO")