import sys readline = sys.stdin.readline def crossing(M, b0, b1): l0, r0 = b0 l1, r1 = b1 t0 = l1 <= r0 and l0 <= r1 l0, r0 = M - 1 - r0, M - 1 - l0 t1 = l1 <= r0 and l0 <= r1 if t0 and t1: return "NG" if t0 or t1: return True return False def dfs(x, G, visited, finished, parity): visited[x] = True for y in G[x]: if visited[y]: if not finished[y] and parity == 1: return True continue dfs(y, G, visited, finished, 1 - parity) finished[x] = True return False def main(): N, M = map(int, readline().split()) blocks = [tuple(map(int, readline().split())) for _ in range(N)] G = [[] for _ in range(N)] for i in range(N): for j in range(i + 1, N): t = crossing(M, blocks[i], blocks[j]) if t == "NG": print("NO") return if t: G[i].append(j) G[j].append(i) visited = [False] * N finished = [False] * N for x in range(N): if finished[x]: continue if dfs(x, G, visited, finished, 1): print('NO') return print('YES') if __name__ == "__main__": main()