import java.io.*; import java.util.*; public class Main_yukicoder622 { private static Scanner sc; private static Printer pr; private static void solve() { double[] a = new double[3]; double[] b = new double[3]; double[] c = new double[3]; double[] d = new double[3]; for (int i = 0; i < 3; i++) { a[i] = sc.nextInt(); } for (int i = 0; i < 3; i++) { b[i] = sc.nextInt(); } for (int i = 0; i < 3; i++) { c[i] = sc.nextInt(); } for (int i = 0; i < 3; i++) { d[i] = sc.nextInt(); } double[] ab = v(a, b); double[] ac = v(a, c); double[] no = cross(ab, ac); double tmp = no[0] * (d[0] - a[0]) + no[1] * (d[1] - a[1]) + no[2] * (d[2] - a[2]); double tmp2 = (double)no[0] * no[0] + (double)no[1] * no[1] + (double)no[2] * no[2]; double t = -tmp / tmp2; double[] p = {d[0] + t * no[0], d[1] + t * no[1], d[2] + t * no[2]}; double[] bc = v(b, c); double[] ca = v(c, a); double[] ap = v(a, p); double[] bp = v(b, p); double[] cp = v(c, p); double[] bccp = cross(bc, cp); double[] abbp = cross(ab, bp); double[] caap = cross(ca, ap); boolean flag = true; if (dot(bccp, abbp) < 0) { flag = false; } if (dot(abbp, caap) < 0) { flag = false; } if (dot(caap, bccp) < 0) { flag = false; } if (flag) { pr.println("YES"); } else { pr.println("NO"); } // pr.printf("%f %f %f\n", no[0], no[1], no[2]); // pr.printf("%f %f %f\n", p[0], p[1], p[2]); } private static double dot(double[] a, double[] b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } private static double[] v(double[] a, double[] b) { double[] ret = {b[0] - a[0], b[1] - a[1], b[2] - a[2]}; return ret; } private static double[] cross(double[] a, double[] b) { double[] ret = {a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]}; return ret; } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }