import Data.List

delLine :: [String] -> [String]
delLine ls = filter (elem '#') ls

main = do
 _ <- getLine
 cell <- fmap lines getContents
 mapM_ putStrLn $ (transpose.delLine.transpose.delLine) cell