#include #define rep(i, a, n) for(int i = a; i < n; i++) #define REP(i, n) rep(i, 0, n) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) using namespace std; typedef pair P; const int mod = 1000000007; const int INF = 1e12; signed main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; rep(i, 0, n){ int x[3], y[3]; rep(j, 0, 3) cin >> x[j]; rep(j, 0, 3) cin >> y[j]; x[0] -= x[1]; x[2] -= x[1]; y[0] -= y[1]; y[2] -= y[1]; bool ans = false; rep(j, 0, 4010){ if(x[0] * x[2] > 0) ans = true; int nx[3] = {}; nx[0] = x[0] + y[0]; nx[2] = x[2] + y[2]; if(nx[0] * x[0] < 0 && nx[2] * x[2] < 0){ if(x[0] * y[2] != x[2] * y[0]) ans = true; } x[0] = nx[0]; x[2] = nx[2]; } if(ans) cout << "YES" << endl; else cout << "NO" << endl; } }