solve 0 _ _ = []
solve h w xs = [take w xs] ++ (solve (h-1) w (tail xs))

main = do
    str <- getLine
    let (h:w:_) = map read $ words str
    if (h,w) == (0,0) then
        return ()
    else do
        putStrLn $ unlines $ solve h w (cycle "#.")
        main