n, m = map(int, input().split()) lr = [tuple(map(int, input().split())) for _ in range(n)] used = [False] * m for i in range(n): ok = True for j in range(m): if lr[i][0] <= j <= lr[i][1] and used[j]: ok = False if ok: for j in range(m): if lr[i][0] <= j <= lr[i][1]: used[j] = True continue ok = True for j in range(m): if m - 1 - lr[i][1] <= j <= m - 1 - lr[i][0] and used[j]: ok = False if ok: for j in range(m): if m - 1 - lr[i][1] <= j <= m - 1 - lr[i][0]: used[j] = True continue print("NO") exit() print("YES")