let readln_t3_str () = let ( @@ ) lst n = List.nth lst n in read_line () |> Str.split (Str.regexp_string " ") |> fun lst -> (lst @@ 0, lst @@ 1, lst @@ 2) let stream_fold f stream init = let result = ref init in Stream.iter (fun x -> result := f !result x) stream; !result let stream_concat sep str_st = match Stream.peek str_st with | None -> "" | Some(_) -> let result = ref (Stream.next str_st) in Stream.iter (fun str -> result := !result ^ sep ^ str) str_st; !result let solve w h c = let c_arr = if c = "B" then [| "B"; "W"; |] else [| "W"; "B"; |] in let make_line y = let ymod2 = y mod 2 in let rec make_line' x result = if x >= w then result else let c_idx = (x + ymod2) mod 2 in make_line' (x + 1) (result ^ c_arr.(c_idx)) in make_line' 0 "" in let line_st = Stream.from (fun y -> if y >= h then None else Some(make_line y)) in stream_concat "\n" line_st let () = let w, h, c = readln_t3_str () |> fun (t1, t2, t3) -> (int_of_string t1, int_of_string t2, t3) in solve w h c |> print_endline