import Control.Applicative ((<$>)) import Data.List (foldl') import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B main :: IO () main = do [h, w] <- map read <$> words <$> getLine n <- readLn solve h w <$> getops n >>= putStrLn solve :: Int -> Int -> [(Char, Int)] -> String solve h w ops = g $ foldl' f (0,0) ops where f (r, c) (s, k) | s == 'R' && r == k = (r, (c-1) `mod` w) | s == 'C' && c == k = ((r-1) `mod` h, c) | otherwise = (r, c) g (r, c) | even (r+c) = "white" | otherwise = "black" getops :: Int -> IO [(Char, Int)] getops n = f n [] where f x acs | x == 0 = return acs | otherwise = do [a, b] <- B.words <$> B.getLine f (x-1) ((B.head a, readi B.readInt b):acs) readi :: Integral a => (ByteString -> Maybe (a, ByteString)) -> ByteString -> a readi f s = let Just (n, _) = f s in n