#include using namespace std; struct point { long double x, y, z; }; bool operator==(const point& pa, const point& pb) { return pa.x == pb.x && pa.y == pb.y && pa.z == pb.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; } inline bool is_parallel(point v_1, point v_2) { return powl(v_1.y * v_2.z - v_1.z * v_2.y, 2) + powl(v_1.z * v_2.x - v_1.x * v_2.z, 2) + powl(v_1.x * v_2.y - v_1.y * v_2.x, 2) < 1e9; } 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; } if (p[0] == p[1] && p[1] == p[2]) { assert(false); ok = true; } else { for (int i = 0; i < 3; i++) { if (p[i] == p[(i + 1) % 3]) { assert(false); point a = get_vec_ab(p[i], p[(i + 2) % 3]); point v = get_vec_ab(p[i], d); auto va = naiseki(v, a); auto aa = naiseki(a, a); cerr << "va = " << va << endl; cerr << "aa = " << aa << endl; if (va <= 0.0 || va >= aa) { ok = false; } else { ok = true; } break; } } } cout << (ok ? "YES" : "NO") << endl; }