using System; using System.Collections.Generic; namespace Yuki { class Program { static void Main(string[] args) { string[] ss = Console.ReadLine().Split(); int n = int.Parse(ss[0]); int m = int.Parse(ss[1]); var li = new List(); bool[] a = new bool[m]; li.Add(a); for (int i = 0; i < n; i++) { var li2 = new List(); ss = Console.ReadLine().Split(); int L = int.Parse(ss[0]); int R = int.Parse(ss[1]); foreach (var item in li) { bool[] item2 = (bool[])item.Clone(); bool f = true; for (int s = L; s <= R; s++) { if (item2[s]) { f = false; break; } else { item2[s] = true; } } if (f) li2.Add(item2); f = true; int L2 = m - 1 - R; int R2 = m - 1 - L; if (L == L2 && R == R2) { } else { for (int s = L2; s <= R2; s++) { if (item[s]) { f = false; break; } else { item[s] = true; } } if (f) li2.Add(item); } } li = li2; } if (li.Count == 0) Console.WriteLine("NO"); else Console.WriteLine("YES"); } } }