/* -*- coding: utf-8 -*- * * 2628.cc: No.2628 Shrinkage - yukicoder */ #include #include using namespace std; /* constant */ /* typedef */ typedef long long ll; template struct Pt { T x, y; Pt() {} Pt(T _x, T _y) : x(_x), y(_y) {} Pt(const Pt &p) : x(p.x), y(p.y) {} Pt operator+(const Pt p) const { return Pt(x + p.x, y + p.y); } Pt operator-() const { return Pt(-x, -y); } Pt operator-(const Pt p) const { return Pt(x - p.x, y - p.y); } Pt operator*(T t) const { return Pt(x * t, y * t); } Pt operator/(T t) const { return Pt(x / t, y / t); } T dot(Pt v) const { return x * v.x + y * v.y; } T cross(Pt v) const { return x * v.y - y * v.x; } T d2() { return x * x + y * y; } bool operator==(const Pt pt) const { return x == pt.x && y == pt.y; } bool operator!=(const Pt pt) const { return x != pt.x || y != pt.y; } bool operator<(const Pt &pt) const { return x < pt.x || (x == pt.x && y < pt.y); } }; typedef Pt pt; /* global variables */ pt readpt() { ll x, y; scanf("%lld%lld", &x, &y); return pt(x, y); } /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { pt p0 = readpt(), p1 = readpt(), q0 = readpt(), q1 = readpt(); if ((p0 == q0 && p1 == q1) || ((p1 - p0).cross(q1 - q0) == 0 && (p1 - p0).dot(q1 - q0) > 0 && (p1 - p0).d2() > (q1 - q0).d2())) puts("Yes"); else puts("No"); } return 0; }