($h,$w)=glob<>; $n=<>; for(reverse<>){ if(/C/){ $y=($y-1)%$h if $x==$'; }else{ / /; $x=($x-1)%$w if $y==$'; } } print$x+$y&1?black:white