-- 解説を参照 import Control.Monad rInt :: String -> Int rInt = read rcTuple [rc,x] = (rc, rInt x) solve _ _ [] r c | ((r + c) `mod` 2) == 0 = "white" | otherwise = "black" solve w h (rc:rcs) r c = solve w h rcs r' c' where r' | (fst rc) == "C" && (snd rc) == c = (r + h - 1) `mod` h | otherwise = r c' | (fst rc) == "R" && (snd rc) == r = (c + w - 1) `mod` w | otherwise = c main = do [w, h] <- map rInt . words <$> getLine n <- rInt <$> getLine rc <- map (rcTuple . words) <$> replicateM n getLine putStrLn $ solve w h rc 0 0