(The answer is B, and I know the total number of ways without restriction is 9C3 but I have no idea how to get to the answer, many thanks in advance)