#include #include #include #include #include #include #include using namespace std; struct P { double inner(const P& p) const { double t = 0; for (int i = 0; i < 3; i++) { t += x[i] * p.x[i]; } return t; } P& operator-=(const P& p) { for (int i = 0; i < 3; i++) { x[i] -= p.x[i]; } return *this; } P& operator*=(const double t) { for (int i = 0; i < 3; i++) { x[i] *= t; } return *this; } double x[3]; }; int main() { P p[4]; for (int i = 0; i < 4; i++) { cin >> p[i].x[0] >> p[i].x[1] >> p[i].x[2]; } P q[4]; memcpy(q, p, sizeof p); int b = 1; for (int j = 0; j < 3; j++) { for (int i = 0; i < 3; i++) { p[i] = q[(i + j) % 3]; } p[3] = q[3]; for (int i = 0; i < 4; i++) { if (i != 2) p[i] -= p[2]; } p[2] -= p[2]; double t0 = p[0].inner(p[0]); double t1 = p[0].inner(p[1]); double r0 = sqrt(t0); p[1] -= (p[0] *= t1 / t0); double t = p[1].inner(p[3]); if (t < 0) b = 0; } cout << (b ? "YES" : "NO") << endl; return 0; }