from itertools import combinations eps = 1e-7 def minimum_bounding_circle_4points(p1, p2, p3, p4): def dist(q1, q2): x1, y1 = q1 x2, y2 = q2 return (x1 - x2) ** 2 + (y1 - y2) ** 2 for q1, q2, q3 in combinations([p1, p2, p3, p4], 3): cp, r = minimum_bounding_circle(q1, q2, q3) if dist(cp, p1) <= r + eps and dist(cp, p2) <= r + eps and dist(cp, p3) <= r + eps and dist(cp, p4) <= r + eps: return cp, r return None def minimum_bounding_circle(p1, p2, p3): def dist(q1, q2): x1, y1 = q1 x2, y2 = q2 return (x1 - x2) ** 2 + (y1 - y2) ** 2 def add(q1, q2): x1, y1 = q1 x2, y2 = q2 return (x1 + x2, y1 + y2) def mul(a, q1): x1, y1 = q1 return (a * x1, a * y1) A = dist(p2, p3) B = dist(p3, p1) C = dist(p1, p2) sa, sb, sc = sorted([A, B, C]) if sa + sb <= sc + eps: c = add(p2, p3) if A == sc else add(p1, p3) if B == sc else add(p1, p2) c = mul(1/2, c) r2 = sc / 4 else: T = A * (B + C - A) U = B * (C + A - B) W = C * (A + B - C) c = mul(1 / (T + U + W), add(add(mul(T, p1), mul(U, p2)), mul(W, p3))) r2 = dist(c, p1) return c, r2 def main(): Q = int(input()) Xa, Ya, Xb, Yb, Xc, Yc = map(int, input().split()) (cx, cy), r = minimum_bounding_circle((Xa, Ya), (Xb, Yb), (Xc, Yc)) def dist(q1, q2): x1, y1 = q1 x2, y2 = q2 return (x1 - x2) ** 2 + (y1 - y2) ** 2 for _ in range(Q): xq, yq = map(int, input().split()) (tx, ty), tr = minimum_bounding_circle_4points( (Xa, Ya), (Xb, Yb), (Xc, Yc), (xq, yq)) if dist((tx, ty), (cx, cy)) <= eps and tr - r <= eps: print("Yes") else: print("No") return 0 main()