using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var a = NList; var b = NList; for (var i = 0; i < 3; ++i) for (var j = 0; j < 3; ++j) { (a[i], b[j]) = (b[j], a[i]); if (IsKadomatsu(a) && IsKadomatsu(b)) { WriteLine("Yes"); return; } (a[i], b[j]) = (b[j], a[i]); } WriteLine("No"); } static bool IsKadomatsu(int[] a) { return a[0] != a[2] && ((a[0] < a[1] && a[1] > a[2]) || (a[0] < a[1] && a[1] > a[2])); } }