program main implicit none type hand character::RC integer::index end type hand integer::H,W,N,i,j,index,r,c character::rc type(hand),allocatable::hands(:) integer,parameter::white=0,black=1 read *,H,W read *,N allocate(hands(N)) read *,hands r = 0 c = 0 do i=N,1,-1 rc = hands(i)%RC index = hands(i)%index select case(rc) case ('R') if(index.eq.r) c = MOD(c-1+W,W) case ('C') if(index.eq.c) r = MOD(r-1+H,H) end select end do if(MOD(r+c,2).eq.white) then print '(a)',"white" else print '(a)',"black" end if end program main