To stimulate his daughter's reasoning, a father made the following drawing and gave it to the child along with three colored pencils. He wants the girl to paint only the circles, so that those connected by a segment have different colors.
In how many different ways can the child do what the father asked?
(A) 6
(B) 12
(C) 18
(D) 24
(E) 72