The image shows 5 rectangles. Luqmon wants to color them red, blue, and yellow in such a way that any two adjacent rectangles are different colors. How many different ways can he do this?