local h, w = io.read("*n", "*n", "*l")
local a, b = {}, {}
for i = 1, h do
  a[i], b[i] = {}, {}
  local s = io.read()
  for j = 1, w do
    local z = s:sub(j, j) == "#"
    if i == 1 then
      a[i][j] = true
      b[i][j] = false
    elseif i == h then
      a[i][j] = false
      b[i][j] = true
    else
      if j % 2 == 0 then
        a[i][j] = true
        b[i][j] = z
      else
        a[i][j] = z
        b[i][j] = true
      end
    end
  end
end
for i = 1, h do
  for j = 1, w do
    io.write(a[i][j] and "#" or ".")
  end
  io.write("\n")
end
io.write("\n")
for i = 1, h do
  for j = 1, w do
    io.write(b[i][j] and "#" or ".")
  end
  io.write("\n")
end
