#include #include #include using namespace std; const double eps = 1e-4; struct point { double x, y; }p[5]; double det(point a, point b, point c) { double x1 = b.x - a.x, y1 = b.y - a.y; double x2 = c.x - a.x, y2 = c.y - a.y; return x1 * y2 - x2 * y1; } double dis(const point a,const point b) { return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y); } bool cmp(const point &a, const point &b) { if (fabs(det(p[0], a, b)) < eps) return dis(p[0], a) < dis(p[0], b); return det(p[0], a, b) > 0; } int main() { int t; scanf("%d",&t); while (t--) { for (int i = 0 ; i < 5 ; i++) scanf("%lf%lf", &p[i].x, &p[i].y); sort(p + 1, p + 5, cmp); bool has = true; for (int i = 1 ; i < 6 ; i++) if (dis(p[i % 5], p[i - 1]) < eps) { has = false; break; } double dist = dis(p[0], p[1]); double d = det (p[0], p[1], p[2]); for (int i = 2 ; i < 7 ; i++) { if (fabs(dis(p[i % 5], p[(i - 1) % 5]) - dist) > eps) { has = false; break; } if (fabs(det(p[(i - 2) % 5], p[(i - 1) % 5], p[i % 5]) - d) > eps) { has = false; break; } } printf("%s\n", (has) ? ("Yes") : ("No")); } return 0; }