import sequtils,algorithm template times*(n:int,body) = (for _ in 0.." .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': return result = 10 * result + k.ord - '0'.ord let n = scan() let m = scan() var U = newSeq[bool](m) let LR = newSeqWith(n,(l:scan(),r:scan())).sortedByIt(-(it.r-it.l)) proc fill(l,r:int) : bool = for i in l..r: if U[i] : return false for i in l..r: U[i] = true return true for lr in LR: let (l,r) = lr if fill(l,r) : continue if fill(m-r-1,m-l-1) : continue quit "NO",0 echo "YES"