#include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif template struct Matrix { int h, w; vector> d; Matrix() {} //初期化のときは Matrix<> a(h, w) Matrix(int h, int w, T val=0): h(h), w(w), d(h, vector(w,val)) {} Matrix& unit() { assert(h == w); rep(i,h) d[i][i] = 1; return *this; } const vector& operator[](int i) const { return d[i];} vector& operator[](int i) { return d[i];} Matrix operator*(const Matrix& a) const { assert(w == a.h); Matrix r(h, a.w); rep(i,h)rep(k,w)rep(j,a.w) { r[i][j] += d[i][k]*a[k][j]; } return r; } //Matcix<> newa = a.pow(k)と使う Matrix pow(long long t) const { assert(h == w); if (!t) return Matrix(h,h).unit(); if (t == 1) return *this; Matrix r = pow(t>>1); r = r*r; if (t&1) r = r*(*this); return r; } }; // p/q struct fraction{ ll p,q; fraction(ll P = 0, ll Q = 1): p(P), q(Q){} bool operator<(const fraction &other)const{ return p*other.q < other.p*q; } bool operator<=(const fraction &other)const{ return p*other.q <= other.p*q; } }; int main() { int q; cin >> q; ll x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; ll a = (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); ll b = (x2-x3)*(x2-x3)+(y2-y3)*(y2-y3); ll c = (x3-x1)*(x3-x1)+(y3-y1)*(y3-y1); __int128_t r; if(a+b> X >> Y; __int128_t x = X*2 ; __int128_t y = Y*2 ; __int128_t R = (xg-x)*(xg-x) + (yg-y) * (yg-y); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } return 0; } else if(a+c> X >> Y; __int128_t x = X*2 ; __int128_t y = Y*2 ; __int128_t R = (xg-x)*(xg-x) + (yg-y) * (yg-y); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } return 0; } else if(b+c> X >> Y; __int128_t x = X*2 ; __int128_t y = Y*2 ; __int128_t R = (xg-x)*(xg-x) + (yg-y) * (yg-y); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } return 0; } if((x2-x1)*(y3-y1) == (x3-x1)*(y2-y1)){ __int128_t Mx = max(x1, max(x2,x3)); __int128_t mx = min(x1, min(x2, x3)); __int128_t My = max(y1,max(y2, y3)); __int128_t my = min(y1,min(y2, y3)); r = (Mx-mx) * (Mx-mx) + (My-my)*(My-my); __int128_t xg = (mx+Mx); __int128_t yg = (my+My); dbg(r); rep(i,q){ ll X, Y; cin >> X >> Y; __int128_t x = X*2 ; __int128_t y = Y*2 ; __int128_t R = (xg-x)*(xg-x) + (yg-y) * (yg-y); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } } else{ __int128_t det = (x2-x1)*(y3-y1) - (x3-x1)*(y2-y1); Matrix<__int128_t> m(2,2); m[1][1] = x2-x1; m[0][1] = -y2+y1; m[0][0] = y3-y1; m[1][0] = -x3+x1; Matrix<__int128_t> f(2,1); f[0][0] = x2*x2+y2*y2 - x1*x1-y1*y1; f[1][0] = x3*x3+y3*y3 - x1*x1-y1*y1; dbg(det); Matrix<__int128_t> e = m*f; r = (e[0][0]-2*det*x1) * (e[0][0]-2*det*x1) + (e[1][0]-2*det*y1) * (e[1][0] - 2*det*y1); dbg(e[0][0], e[1][0]); dbg(r); rep(i,q){ ll X, Y; cin >> X >> Y; __int128_t x = X*2*det ; __int128_t y = Y*2*det ; __int128_t R = (e[0][0]-x)*(e[0][0]-x) + (e[1][0]-y) * (e[1][0]-y); dbg(r, R); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } } return 0; }