import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); PriorityQueue queue = new PriorityQueue<>(); for (int i = 0; i < n; i++) { queue.add(new Block(m, br.readLine())); } int start = -1; while (queue.size() > 0) { Block b = queue.poll(); if (start < b.left) { start = b.right; } else { b.reverse(); if (start < b.left) { queue.add(b); } else { System.out.println("NO"); return; } } } System.out.println("YES"); } static class Block implements Comparable { int size; int left; int right; public Block(int size, String line) { this.size = size; String[] arr = line.split(" ", 2); left = Integer.parseInt(arr[0]); right = Integer.parseInt(arr[1]); if (left > size - right - 1) { reverse(); } } public int compareTo(Block another) { if (left == another.left) { return right - another.right; } else { return left - another.left; } } public void reverse() { int tmp = right; right = size - left - 1; left = size - tmp - 1; } public String toString() { return "size:" + size + " left:" + left + " right:" + right; } } }