let () = Scanf.scanf "%d %d\n" @@ fun h w ->
  let ass = Array.init h @@ fun _ ->
    Scanf.scanf "%s\n" @@ fun as_ -> as_ in
  let red = Array.map String.copy ass in
  let blue = Array.map String.copy ass in
  for i = 0 to w - 1 do
    red.(0).[i] <- '#';
    blue.(h - 1).[i] <- '#'
  done;
  for i = 1 to h - 2 do
    for j = 0 to w - 1 do
      if j mod 2 = 0 then
        red.(i).[j] <- '#'
      else
        blue.(i).[j] <- '#'
    done
  done;
  Array.iter print_endline red;
  print_newline ();
  Array.iter print_endline blue
