#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) #if defined(_MSC_VER) || __cplusplus > 199711L #define aut(r,v) auto r = (v) #else #define aut(r,v) __typeof(v) r = (v) #endif #define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it) #define all(o) (o).begin(), (o).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset(m,v,sizeof(m)) #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef vector vi; typedef pair pii; typedef vector > vpii; typedef long long ll; template inline void amin(T &x, U y) { if(y < x) x = y; } template inline void amax(T &x, U y) { if(x < y) x = y; } struct P { typedef int T; typedef ll T2; //T2は{a*b | a:T, b:T}を含むタイプ T x, y; P(T x_, T y_): x(x_), y(y_) {} P(): x(0), y(0) {} }; inline bool operator==(const P& a, const P& b) { return a.x == b.x && a.y == b.y; } inline bool operator<(const P& a, const P& b) { return a.x < b.x || (a.x == b.x && a.y < b.y); } inline P operator+(const P& a, const P& b) { return P(a.x+b.x, a.y+b.y); } inline P operator-(const P& a, const P& b) { return P(a.x-b.x, a.y-b.y); } inline P operator-=(P& a, const P& b) { a.x -= b.x, a.y -= b.y ; return a; } inline P::T2 cross(const P& a, const P& b) { return (P::T2)a.x*b.y - (P::T2)a.y*b.x; } inline P::T2 dot(const P& a, const P& b) { return (P::T2)a.x*b.x + (P::T2)a.y*b.y; } inline P::T2 norm(const P& a) { return (P::T2)a.x*a.x + (P::T2)a.y*a.y; } ostream& operator<<(ostream& out, const P& x) { out << "(" << x.x << ", " << x.y << ")"; return out; } struct L { P a, b; L(const P &a_, const P &b_): a(a_), b(b_) {} const P& operator[](size_t i) const { return i ? b : a; } }; inline int ccw(const P& a, const P& b, const P& c) { int ax = b.x - a.x, ay = b.y - a.y, bx = c.x - a.x, by = c.y - a.y; P::T2 t = (P::T2)ax*by - (P::T2)ay*bx; if (t > 0) return 1; if (t < 0) return -1; if((P::T2)ax*bx + (P::T2)ay*by < 0) return +2; if((P::T2)ax*ax + (P::T2)ay*ay < (P::T2)bx*bx + (P::T2)by*by) return -2; return 0; } int intersectSS(const L &s, const L &t) { assert(!(s.a == s.b || t.a == t.b)); int a = ccw(s.a,s.b,t.a), b = ccw(s.a,s.b,t.b), c = ccw(t.a,t.b,s.a), d = ccw(t.a,t.b,s.b); int x = a * b, y = c * d; if(x == -1 && y == -1) return 4; //cross else if( ((abs(b) == 1 || b == -2) && s.b == t.a) || ((abs(b) == 1 || b == 2) && s.a == t.a) || ((abs(a) == 1 || a == -2) && s.b == t.b) || ((abs(a) == 1 || a == 2) && s.a == t.b) ) return 2; // point overlap (真ん中と端を共有する) else if( (x == 0 && (abs(a) + abs(b) == 1)) || (y == 0 && (abs(c) + abs(d) == 1)) ) return 3; // point overlap (端点のみを共有する) else if(x <= 0 && y <= 0) return 0; //segment overlap else return 1; } int main() { P ps[5]; rep(k, 5) cin >> ps[k].x >> ps[k].y; sort(ps, ps + 5); bool ans = false; do { bool ok = true; rep(k, 5) { L s(ps[k], ps[(k+2)%5]); L t(ps[(k+1)%5], ps[(k+3)%5]); ok &= intersectSS(s, t) == 4; } ans |= ok; }while(next_permutation(ps, ps + 5)); puts(ans ? "YES" : "NO"); return 0; }