class SCCGraph
    def initialize(n = 0)
        @n, @edges = n, []
    end
  
    def add_edge(from, to); @edges << [from, to]; end
  
    # returns list of strongly connected components
    # the components are sorted in topological order
    # O(N + M)
    def scc
        group_num, ids = scc_ids
        counts = Array.new(group_num, 0)
        ids.each { |x| counts[x] += 1 }
        groups = Array.new(group_num) { [] }
        ids.each_with_index { |x, i| groups[x] << i }
        groups
    end

    def scc_ids
        start, elist = csr
        now_ord = group_num = 0
        visited, low, ord, ids = [], [], [-1] * @n, []

        dfs = ->(v) {
            low[v] = ord[v] = now_ord
            now_ord += 1
            visited << v
            (start[v]...start[v + 1]).each do |i|
                to = elist[i]
                low[v] = if ord[to] == -1
                    dfs.(to)
                    [low[v], low[to]].min
                else
                    [low[v], ord[to]].min
                end
            end

            if low[v] == ord[v]
                loop do
                    u = visited.pop
                    ord[u] = @n
                    ids[u] = group_num
                    break if u == v
                end
                group_num += 1
            end
        }
        @n.times { |i| dfs.(i) if ord[i] == -1 }
        ids = ids.map { |x| group_num - 1 - x }
        [group_num, ids]
    end
  
    def csr
        start = Array.new(@n+1, 0)
        elist = Array.new(@edges.size)
        @edges.each { |(i, _)| start[i + 1] += 1 }
        @n.times { |i| start[i + 1] += start[i] }
        counter = start.dup
        @edges.each do |(i, j)|
            elist[counter[i]] = j
            counter[i] += 1
        end
        [start, elist]
    end
end

class Two_Sat
    def initialize(n)
        @n = n
        @answer = Array.new(n)
        @scc = SCCGraph.new(2 * n)
    end

    def add_clause(i, f, j, g)
        @scc.add_edge(2 * i + (f ? 0 : 1), 2 * j + (g ? 1 : 0))
        @scc.add_edge(2 * j + (g ? 0 : 1), 2 * i + (f ? 1 : 0))
    end

    def satisfiable
        id = @scc.scc_ids[1]
        @n.times do |i|
            return false if id[2 * i] == id[2 * i + 1]
            @answer[i] = id[2 * i] < id[2 * i + 1]
        end
        true
    end

    def answer; @answer; end
end

n, d = gets.split.map(&:to_i)
ts = Two_Sat.new(n)

xy = []
n.times do |i|
    s, t = gets.split.map(&:to_i)
    xy.each_with_index do |(x, y), j|
        ts.add_clause(i, false, j, false) if (s - x).abs < d
        ts.add_clause(i, false, j, true) if (s - y).abs < d
        ts.add_clause(i, true, j, false) if (t - x).abs < d
        ts.add_clause(i, true, j, true) if (t - y).abs < d
    end
    xy << [s, t]
end

if ts.satisfiable
    puts "Yes"
    ts.answer.each_with_index {|e, i| puts e ? xy[i][0] : xy[i][1]}
else
    puts "No"
end