import std.algorithm; import std.array; import std.ascii; import std.container; import std.conv; import std.math; import std.numeric; import std.range; import std.stdio; import std.string; import std.typecons; void log(A...)(A arg) { //stderr.writeln(arg); } int size(T)(in T s) { return cast(int)s.length; } immutable real EPS = 1e-7; struct Point { real x, y; Point opBinary(string op)(in Point p) const if (op == "+" || op == "-") { return Point(mixin("x" ~ op ~ "p.x"), mixin("y" ~ op ~ "p.y")); } Point opBinary(string op)(real k) const if (op == "*" || op == "/") { return Point(mixin("x" ~ op ~ "k"), mixin("y" ~ op ~ "k")); } }; real dot(in Point a, in Point b) { return a.x * b.x + a.y * b.y; } real cross(in Point a, in Point b) { return a.x * b.y - a.y * b.x; } real norm(in Point a) { return sqrt(dot(a, a)); } Point rot90(in Point p) { return Point(-p.y, p.x); } real angle(in Point a) { return atan2(a.y, a.x); } int ccw(Point a, Point b, Point c){ b = b - a; c = c - a; if (cross(b, c) > EPS) return +1; if (cross(b, c) < -EPS) return -1; if (dot(b, c) < 0) return +2; if (norm(b) < norm(c)) return -2; return 0; } struct Segment { Point a, b; }; bool intersects(in Segment s, in Segment t) { return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) < 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) < 0; } void main() { auto ps = new Point[5]; foreach (ref p; ps) { readf("%s %s\n", &p.x, &p.y); } ps.sort!"a.x < b.x"; do { Segment[] ss; foreach (int i; 0 .. 5) { ss ~= Segment(ps[i], ps[(i + 1) % 5]); } log(ps); foreach (i; 0 .. 5) { int c = 0; foreach (j; 0 .. 5) { if (i == j) continue; if (intersects(ss[i], ss[j])) { log([i, j]); c++; } } if (c != 2) goto next; } writeln("YES"); return; next:; } while (ps.nextPermutation!"a.x < b.x"); writeln("NO"); }