generateIchimatsu :: [String] -> String
generateIchimatsu (w : h : c : _)
    | c == "B"  = generateIchimatsu' ["BW", "WB"]
    | otherwise = generateIchimatsu' ["WB", "BW"]
    where
        [w', h'] = map read [w, h]
        generateIchimatsu' = unlines . take h' . cycle . map (take w' . cycle)

main :: IO ()
main = putStr . generateIchimatsu . words =<< getLine