Tom needs to paint a straight fence consisting of 6 panels. He has green, red, and magenta paint, and each panel should be painted with only one color.

a) How many ways are there to paint the fence?

b) How many ways are there to paint the fence if the second panel must be green, and no two adjacent panels can be the same color?

c) How many ways are there to paint the fence if the second panel must be green, and the first and sixth panels must be different colors?