import Data.List(transpose)
import Control.Monad(forM_)

main = do
  ns <- lines <$> getContents
  forM_ (solve (tail ns)) putStrLn

solve :: [String] -> [String]
solve ls = remove $ transpose $ remove $ transpose ls

remove :: [String] -> [String]
remove ls = filter (any (=='#')) ls