#include #include #include #include #include using namespace std; double slope(double x1, double y1, double x2, double y2){ return (y2-y1)/(x2-x1); } int main() { int n; cin >> n; while(n--){ double a1,a2,b1,b2,c1,c2,d1,d2; cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2 >> d1 >> d2; int flag = 0; if(slope(a1,a2,b1,b2) == slope(c1,c2,d1,d2) || slope(a1,a2,b1,b2) == -slope(c1,c2,d1,d2)) flag = 1; if(slope(a1,a2,c1,c2) == slope(b1,b2,d1,d2) || slope(a1,a2,c1,c2) == -slope(b1,b2,d1,d2)) flag = 1; if(slope(a1,a2,d1,d2) == slope(c1,c2,b1,b2) || slope(a1,a2,d1,d2) == -slope(c1,c2,b1,b2)) flag = 1; if(flag) cout << "NO" << endl; else{cout << "YES" << endl;} } return 0; }