#include #include using namespace std; #define rep(i,n) for(long long i = 0; i < (long long)(n); i++) using ll = long long; using vd = vector; bool is_k(vd x) { if (x[0] == x[1]) return false; if (x[1] == x[2]) return false; if (x[2] == x[0]) return false; if (x[0] <= x[1] && x[1] <= x[2]) return false; if (x[0] >= x[1] && x[1] >= x[2]) return false; return true; } ll sgn(double x) { if (x > 0) return 1; if (x < 0) return -1; else return 0; } bool eq(double x, double y) { return abs(x - y) < 1e-10; } #define RET_YES cout << "YES" << endl; continue; #define RET_NO cout << "NO" << endl; continue; int main(void) { ll _; cin >> _; rep(__, _) { vd x(3), y(3); cin >> x[0] >> x[1] >> x[2] >> y[0] >> y[1] >> y[2]; if (is_k(x)) { RET_YES; } if (is_k(y)) { RET_YES; } if (y[0] == y[1] && y[1] == y[2]) { RET_NO; } if (x[0] == x[2]) { if (x[0] == x[1]) { RET_NO; } else if (y[0] == y[2]) { RET_NO; } else { RET_YES; } } else { if (y[0] == y[2]) { RET_YES; } else if (sgn(x[0] - x[2]) == sgn(y[0] - y[2])) { RET_NO; } else { if (x[0] < x[2]) swap(x[0], x[2]), swap(y[0], y[2]); double t = -(x[2] - x[0]) / (y[2] - y[0]); if (eq(x[0] + t * y[0], x[1] + t * y[1])) { RET_NO; } else { RET_YES; } } } } return 0; }