#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; bool solve(const vector& x, const vector& y){ if(x[0] == x[1] && y[0] == y[1]) return false; if(x[1] == x[2] && y[1] == y[2]) return false; if(x[0] == x[2] && y[0] == y[2]) return false; double T1 = (x[0] - x[1]) / (double)(y[1] - y[0]); double T2 = (x[1] - x[2]) / (double)(y[2] - y[1]); double mn = min(T1, T2), mx = max(T1, T2); if(mx < 0) return false; if(isinf(mn) > 0 && isinf(mx) > 0) return false; return true; } int main(){ int N; cin >> N; rep(t,N){ vector x(3), y(3); rep(i,3) cin >> x[i]; rep(i,3) cin >> y[i]; if(solve(x, y)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }