main = getLine >>= mapM_ putStrLn . solve . words solve :: [String] -> [String] solve [w, h, c] = take (read h) ys where (x : xs) = cycle $ if c == "B" then "BW" else "WB" a = take (read w) $ x : xs b = take (read w) $ xs ys = cycle [a, b]