INF = 1000000000 def solve(x1, x2, x3, y1, y2, y3) if (x1 == x2 && y1 == y2) || (x3 == x2 && y3 == y2) || (x1 == x3 && y1 == y3) return false end v1 = y1 * INF + x1 v2 = y2 * INF + x2 v3 = y3 * INF + x3 if (v2 < v1 && v2 < v3) || (v2 > v1 && v2 > v3) return true end if y1 == y2 && y3 == y2 return false end if y1 == y3 return false end if y1 == y2 f3 = -1.0 * (x3 - x2) / (y3 - y2) return f3 > 0 elsif y3 == y2 f1 = -1.0 * (x1 - x2) / (y1 - y2) return f1 > 0 else f1 = -1.0 * (x1 - x2) / (y1 - y2) f3 = -1.0 * (x3 - x2) / (y3 - y2) if [f1, f3].max >= 0 if [f1, f3].max == 0 return (x2 < x1 && x2 < x3) || (x2 > x1 && x2 > x3) elsif f1 == f3 return false else return true end else return false end end end n = gets.to_i n.times do |i| puts solve(*gets.split.map(&:to_i)) ? "YES" : "NO" end