main = getLine >>= mapM putStrLn . solve . (\[w, h, c] -> (map read [w, h], c)) . words solve :: ([Int], String) -> [String] solve ([w, h], c) = reverse $ f h where d = if c == "B" then "W" else "B" w2 = div w 2 cd = concat $ zipWith (++) (replicate w2 c) (replicate w2 d) dc = reverse cd oddL = if odd w then cd ++ c else cd evenL = if odd w then dc ++ d else dc f 0 = [] f i | odd i = oddL : f (i - 1) | otherwise = evenL : f (i - 1)