using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static double[] NList => ReadLine().Split().Select(double.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var a = NList; var b = NList; var c = NList; var d = NList; var oa = new double[3]; var ob = new double[3]; for (var i = 0; i < 3; ++i) { oa[i] = b[i] - a[i]; ob[i] = c[i] - a[i]; } var op = OuterProduct(oa, ob); { var div = Len(oa, new double[3]) * Len(ob, new double[3]); op = (op.ox / div, op.oy / div, op.oz / div); } var left = -2_000_000.0; var right = 2_000_000.0; while (right - left > 0.001) { var mid1 = (left * 2 + right) / 3; var mid2 = (left + right * 2) / 3; var a1 = new double[] { a[0] + op.ox * mid1, a[1] + op.oy * mid1, a[2] + op.oz * mid1 }; var a2 = new double[] { a[0] + op.ox * mid2, a[1] + op.oy * mid2, a[2] + op.oz * mid2 }; var len1 = Len(a1, d); var len2 = Len(a2, d); if (len1 < len2) right = mid2; else left = mid1; } var lr = (left + right) / 2; d[0] -= op.ox * lr; d[1] -= op.oy * lr; d[2] -= op.oz * lr; var abc = Area(a, b, c); var abcd = Area(a, b, d) + Area(b, c, d) + Area(c, a, d); WriteLine(abcd - abc > 0.0005 ? "NO" : "YES"); } static double Area(double[] a, double[] b, double[] c) { var al = Len(a, b); var bl = Len(b, c); var cl = Len(c, a); var s = (al + bl + cl) / 2; return Math.Sqrt(s * (s - al) * (s - bl) * (s - cl)); } static (double ox, double oy, double oz) OuterProduct(double[] a, double[] b) { return (a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]); } static double Len(double[] a, double[] b) { return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2])); } }