import Control.Applicative
import Data.List

main = do
  [h,w] <- map read . words <$> getLine :: IO [Int]
  field <- lines <$> getContents

  let
    red = [if odd i then reverse ('.' : replicate (w-1) '#') else '#' : replicate (w-1) '.' | i<-[1..h]]
    blue = [if odd i then reverse ('#' : replicate (w-1) '.') else '.' : replicate (w-1) '#' | i<-[1..h]]

  let
    red' = add red field
    blue' = add blue field

  --mapM_ print $ mul red' blue'

  mapM_ putStrLn $ red'
  putStrLn ""
  mapM_ putStrLn $ blue'
  


f '#' '#' = '#'
f '.' '.' = '.'
f _ _ = '#'

g '#' '#' = '#'
g _ _ = '.'

add a b = zipWith (zipWith (\x y -> f x y)) a b

mul a b = zipWith (zipWith (\x y -> g x y)) a b
