#include int sign(long long a) { return a > 0 ? 1 : a < 0 ? -1 : 0; } const long long INF = 1e9; struct Qu { long long a, b; Qu(): a(0), b(0) {} Qu(long long a_, long long b_): a(a_), b(b_) { if (b == 0) { a = INF; b = 0; } else { long long g = std::gcd(std::abs(a), std::abs(b)); a /= g; b /= g; if (sign(a) != sign(b)) { if (b < 0) { a = -a; b = -b; } } else if (a < 0) { a = -a; b = -b; } } } Qu(long long v): Qu(v, 1) {} }; std::ostream& operator<<(std::ostream& os, Qu q) { os << q.a << '/' << q.b; return os; } Qu operator+(Qu lhs, Qu rhs) { long long b = lhs.b * rhs.b; long long a = lhs.a * rhs.b + rhs.a * lhs.b; return Qu(a, b); } Qu operator-(Qu lhs, Qu rhs) { long long b = lhs.b * rhs.b; long long a = lhs.a * rhs.b - rhs.a * lhs.b; return Qu(a, b); } Qu operator*(Qu lhs, Qu rhs) { return Qu(lhs.a * rhs.a, lhs.b * rhs.b); } Qu operator/(Qu lhs, Qu rhs) { return Qu(lhs.a * rhs.b, lhs.b * rhs.a); } bool eq(Qu lhs, Qu rhs) { return lhs.a == rhs.a && lhs.b == rhs.b; } bool lt(Qu lhs, Qu rhs) { Qu l(lhs.a * rhs.b, lhs.b * rhs.b); Qu r(rhs.a * lhs.b, rhs.b * lhs.b); return l.a <= r.a; } struct Point { Point() {} Point(Qu x, Qu y): x(x), y(y) {} Qu x, y; }; Point mid_point(Point lhs, Point rhs) { return Point((lhs.x + rhs.x) / 2, (lhs.y + rhs.y) / 2); } const Qu UNDEF(INF, 0); struct Line { Qu coef; Qu constant; Line() {} Line(Qu coe, Qu con): coef(coe), constant(con) {} Line(Qu coef, Point point): coef(coef), constant(point.y - point.x * coef) {} }; bool eq(Line lhs, Line rhs) { return eq(lhs.coef, rhs.coef) && eq(lhs.constant, rhs.constant); } Qu distance(Point lhs, Point rhs) { return (lhs.x - rhs.x) * (lhs.x - rhs.x) + (lhs.y - rhs.y) * (lhs.y - rhs.y); } struct Circle { Point center; Qu radius; Circle(Point p, Qu r): center(p), radius(r) {} }; bool inside(Circle circle, Point point) { return lt(distance(circle.center, point), circle.radius); } void solve() { int q; std::cin >> q; std::vector points(3); for (int i = 0; i < 3; i++) { int x, y; std::cin >> x >> y; points[i] = Point(x, y); } std::vector lines(2); for (int i = 0; i < 2; i++) { if (eq(points[i].y, points[i + 1].y)) { Point mid = mid_point(points[i], points[i + 1]); lines[i] = Line(UNDEF, mid.x); } else { Qu coef = (points[i + 1].x - points[i].x) / (points[i].y - points[i + 1].y); Point mid = mid_point(points[i], points[i + 1]); lines[i] = Line(coef, mid); } } Point center; if (eq(lines[0].coef, lines[1].coef)) { Qu min_dist(INF); for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 3; j++) { Point mid = mid_point(points[i], points[j]); Qu dist(0); for (int k = 0; k < 3; k++) { Qu d = distance(mid, points[k]); if (lt(dist, d)) { dist = d; } } if (lt(dist, min_dist)) { min_dist = dist; center = mid; } } } } else { if (eq(lines[0].coef, UNDEF) || eq(lines[1].coef, UNDEF)) { if (eq(lines[0].coef, UNDEF)) std::swap(lines[0], lines[1]); center.x = lines[1].constant; center.y = lines[0].coef * center.x + lines[0].constant; } else { center.x = (lines[1].constant - lines[0].constant) / (lines[0].coef - lines[1].coef); center.y = (lines[0].coef * lines[1].constant - lines[0].constant * lines[1].coef) / (lines[0].coef - lines[1].coef); } Qu d = distance(points[0], center); for (int i = 1; i < 3; i++) {} } Qu radius = 0; for (int i = 0; i < 3; i++) { Qu r = distance(center, points[i]); if (lt(radius, r)) { radius = r; } } Circle circle(center, radius); while (q--) { int x, y; std::cin >> x >> y; Point p(x, y); std::cout << (inside(circle, p) ? "Yes" : "No") << '\n'; } } int main() { std::cin.tie(0)->sync_with_stdio(0); std::cout << std::fixed << std::setprecision(16); int t = 1; while (t--) solve(); }