#include using namespace std; struct point { long double x, y, z; }; point p[3], d; inline point get_vec_ab(point pa, point pb) { point ab; ab.x = pb.x - pa.x; ab.y = pb.y - pa.y; ab.z = pb.z - pa.z; return ab; } inline long double naiseki(point pa, point pb) { return pa.x * pb.x + pa.y * pb.y + pa.z * pb.z; } long double gaiseki(point a, point b){ return (a.y *b.z - a.z * b.y )+ (a.z * b.x - a.x * b.z) + (a.x * b.y - a.y * b.x); } int main() { for (int i = 0; i < 3; i++) { cin >> p[i].x >> p[i].y >> p[i].z; } cin >> d.x >> d.y >> d.z; bool ok = true; for (int i = 0; i < 3; i++) { point v_d = get_vec_ab(p[i], d); point v_1 = get_vec_ab(p[i], p[(i + 1) % 3]); point v_2 = get_vec_ab(p[i], p[(i + 2) % 3]); ok &= naiseki(v_d, v_1) > 0 && naiseki(v_d, v_2) > 0; } for (int i = 0; i < 3; i++) { point v_1 = get_vec_ab(p[i], p[(i + 1) % 3]); point v_2 = get_vec_ab(p[i], p[(i + 2) % 3]); if (gaiseki(v_1, v_2) < -1e9) { ok = false; } } cout << (ok ? "YES" : "NO") << endl; }