#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair #define pll pair const int inf = 1000000001; const ll INF = 2e18 * 2; #define MOD 1000000007 #define mod 1000000009 #define pi 3.14159265358979323846 #define Sp(p) cout< double dot(P a, P b) { return (a.real() * b.real() + a.imag() * b.imag()); } int main() { int i, j; vector x(4), y(4), z(4); for (i = 0; i < 4; i++) { cin >> x[i] >> y[i] >> z[i]; } for (i = 3; i >= 0; i--) { x[i] -= x[0]; y[i] -= y[0]; z[i] -= z[0]; } /* for (i = 0; i < 4; i++) { printf("(%lf, %lf, %lf)\n", x[i], y[i], z[i]); } cout << endl; //*/ double theta = atan2(y[1], x[1]); for (i = 3; i >= 1; i--) { double xt = x[i], yt = y[i]; x[i] = xt*cos(theta) + yt*sin(theta); y[i] = yt*cos(theta) - xt*sin(theta); } /* for (i = 0; i < 4; i++) { printf("(%lf, %lf, %lf)\n", x[i], y[i], z[i]); } cout << endl; //*/ theta = atan2(z[1], x[1]); for (i = 3; i >= 1; i--) { double xt = x[i], zt = z[i]; x[i] = xt * cos(theta) + zt * sin(theta); z[i] = zt * cos(theta) - xt * sin(theta); } /* for (i = 0; i < 4; i++) { printf("(%lf, %lf, %lf)\n", x[i], y[i], z[i]); } cout << endl; //*/ theta = atan2(z[2], y[2]); for (i = 3; i >= 2; i--) { double yt = y[i], zt = z[i]; y[i] = yt * cos(theta) + zt * sin(theta); z[i] = zt * cos(theta) - yt * sin(theta); } /* for (i = 0; i < 4; i++) { printf("(%lf, %lf, %lf)\n", x[i], y[i], z[i]); } cout << endl; //*/ P p[4]; for (i = 0; i < 4; i++) { p[i].real(x[i]); p[i].imag(y[i]); } vector c(3); for (i = 0; i < 3; i++) { c[i] = dot(p[(i + 1) % 3] - p[i], p[3] - p[(i + 1) % 3]); } if ((c[0] > 0 && c[1] > 0 && c[2] > 0) || (c[0] < 0 && c[1] < 0 && c[2] < 0)) { cout << "YES" << endl; } else { cout << "NO" << endl; } }