function main()
  local input = string.gmatch(io.read(), "[^ ]+")
  local n = tonumber(input())
  local l = 2*tonumber(input())
  local t = tonumber(input())
  local x = {}
  local w = {}
  for i = 1, n do
    input = string.gmatch(io.read(), "[^ ]+")
    table.insert(x, 2 * tonumber(input()))
    table.insert(w, tonumber(input()))
  end

  for i = 1, 2*t do
    for j = 1, n do
      if w[j] == 1 then
        x[j] = (x[j] + 1)%l
      else
        x[j] = (x[j] - 1)%l
      end
    end
    for j = 1, n do
      local target = j - 1
      if target == 0 then
        target = n
      end
      if x[target] == x[j] then
        w[target] = -(w[target] - 3)
        w[j] = -(w[j] - 3)
      end
    end
  end

  for i = 1, n do
    print(x[i]/2)
  end
end

main()
