W1,W2 cannot occur after r2,w2,r3,w3 (according to precedence graph) so they can occupy only the first two places in 2 ways -w1,w2 or w2,w1.
similarly r2,w2 cannot occur after r3,w3. so they can occupy only the middle two places. so no of possible combinations- r2,w2 or w2,r2. again 2 ways.
same for r3,w3.(2 ways.
so total ways=2*2*2