local mab = math.abs
local n, d = io.read("*n", "*n")
local edge = {}
local edge_asked = {}
local invedge = {}
local invedge_asked = {}
for i = 1, 2 * n do
  edge[i] = {}
  edge_asked[i] = 0
  invedge[i] = {}
  invedge_asked[i] = 0
end
local edgeinfo = {}
local xs, ys = {}, {}
for i = 1, n do
  xs[i], ys[i] = io.read("*n", "*n")
end
local function addedge(src, dst)
  table.insert(edgeinfo, {src, dst})
  table.insert(edge[src], dst)
  table.insert(invedge[dst], src)
end
for i = 1, n - 1 do
  for j = i + 1, n do
    f1 = mab(xs[i] - xs[j]) < d
    f2 = mab(xs[i] - ys[j]) < d
    f3 = mab(ys[i] - xs[j]) < d
    f4 = mab(ys[i] - ys[j]) < d
    if f1 and not f2 then addedge(i, n + j) end
    if f2 and not f1 then addedge(i, j) end
    if f3 and not f4 then addedge(n + i, n + j) end
    if f4 and not f3 then addedge(n + i, j) end
    if f1 and not f3 then addedge(j, n + i) end
    if f3 and not f1 then addedge(j, i) end
    if f2 and not f4 then addedge(n + j, n + i) end
    if f4 and not f2 then addedge(n + j, i) end

    if f1 and f2 then addedge(i, n + i) end
    if f3 and f4 then addedge(n + i, i) end
    if f1 and f3 then addedge(j, n + j) end
    if f2 and f4 then addedge(n + j, j) end
  end
end
local rawn = n
n = n * 2

local asked = {}
local sccd_root = {}
for i = 1, n do
  asked[i] = false
  sccd_root[i] = 0
end

local function SCCD_dfs(spos, dfs_way)
  local tasks = {spos}
  while 0 < #tasks do
    local src = tasks[#tasks]
    asked[src] = true
    table.remove(tasks)
    if edge_asked[src] == #edge[src] then
      table.insert(dfs_way, src)
    else
      table.insert(tasks, src)
      edge_asked[src] = edge_asked[src] + 1
      local dst = edge[src][edge_asked[src]]
      if not asked[dst] then
        table.insert(tasks, dst)
      end
    end
  end
end

local function SCCD_invdfs(spos, rootid)
  local tasks = {spos}
  while 0 < #tasks do
    local src = tasks[#tasks]
    sccd_root[src] = rootid
    table.remove(tasks)
    while invedge_asked[src] < #invedge[src] do
      invedge_asked[src] = invedge_asked[src] + 1
      local dst = invedge[src][invedge_asked[src]]
      if asked[dst] and sccd_root[dst] == 0 then
        table.insert(tasks, src)
        table.insert(tasks, dst)
        break
      end
    end
  end
end

local function SCCD_categorize()
  for src = 1, n do
    if not asked[src] then
      local dfs_way = {}
      SCCD_dfs(src, dfs_way)
      for i = #dfs_way, 1, -1 do
        local src = dfs_way[i]
        if sccd_root[src] == 0 then
          SCCD_invdfs(src, src)
        end
      end
    end
  end
end

local gsize = {}
local gedge, ginvedge = {}, {}
local glen = {}
local gmember = {}

local function SCCD_make_group_graph()
  for i = 1, n do
    gsize[i] = 0
    gedge[i], ginvedge[i] = {}, {}
    glen[i] = 0
    gmember[i] = {}
  end
  for i = 1, n do
    local r = sccd_root[i]
    gsize[r] = gsize[r] + 1
    table.insert(gmember[r], i)
  end
  for i = 1, #edgeinfo do
    local a, b = edgeinfo[i][1], edgeinfo[i][2]
    local ra, rb = sccd_root[a], sccd_root[b]
    if ra ~= rb then
      table.insert(gedge[ra], rb)
      table.insert(ginvedge[rb], ra)
    end
  end
end

local function SCCD_toposort()
  local topo_tasks = {}
  local topo_asked_cnt = {}
  for i = 1, n do
    topo_asked_cnt[i] = 0
    if 0 < gsize[i] and #ginvedge[i] == 0 then
      table.insert(topo_tasks, i)
    end
  end
  local topoary = {}
  local topo_done = 0
  while topo_done < #topo_tasks do
    topo_done = topo_done + 1
    local g = topo_tasks[topo_done]
    topoary[topo_done] = g
    for i = 1, #gedge[g] do
      local dst = gedge[g][i]
      topo_asked_cnt[dst] = topo_asked_cnt[dst] + 1
      if topo_asked_cnt[dst] == #ginvedge[dst] then
        table.insert(topo_tasks, dst)
      end
    end
  end
  return topoary
end

SCCD_categorize()
SCCD_make_group_graph()

for i = 1, rawn do
  if sccd_root[i] == sccd_root[i + rawn] then
    print("No") os.exit()
  end
end
print("Yes")
local determined = {}
local retpos = {}
for i = 1, rawn do
  determined[i] = false
  retpos[i] = -1
end

local topoary = SCCD_toposort()
for i = 1, #topoary do
  local g = topoary[i]
  for j = 1, #gmember[g] do
    local idx = gmember[g][j]
    if idx <= rawn then
      if not determined[idx] then
        retpos[idx] = ys[idx]
        determined[idx] = true
      end
    else
      if not determined[idx - rawn] then
        retpos[idx - rawn] = xs[idx - rawn]
        determined[idx - rawn] = true
      end
    end
  end
end
print(table.concat(retpos, "\n"))
