import Data.List

main :: IO ()
main = interact $ unlines . map (convert . map read . words) . init . lines

convert :: [Int] -> String
convert [h,w] = unlines . take h . map (take w) . tails . cycle $ "#."
