#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define X first #define Y second #define EQ(x, y) (fabs((x) - (y)) < eps) using namespace std; typedef pair Point; const double eps = 1e-4; struct Comp { Point o; bool operator()(const Point& a, const Point& b) const { double d1 = atan2(a.Y - o.Y, a.X - o.X); double d2 = atan2(b.Y - o.Y, b.X - o.X); return d1 < d2; } }; Point p[16]; double Dis(const Point& a, const Point& b) { return sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y)); } bool Check() { Point o = make_pair(0.0, 0.0); for (int i = 0; i < 5; ++i) { o.X += p[i].X; o.Y += p[i].Y; } o.X /= 5.0; o.Y /= 5.0; double d = Dis(o, p[0]); for (int i = 1; i < 5; ++i) { if (!EQ(Dis(o, p[i]), d)) return false; } Comp cmp; cmp.o = o; sort(p, p + 5, cmp); double l = Dis(p[0], p[4]); for (int i = 1; i < 4; ++i) { if (!EQ(Dis(p[i - 1], p[i]), l)) return false; } return true; } 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); } printf("%s\n", Check() ? "Yes" : "No"); } return 0; }