5. A toy factory produces cubic building blocks of the same size, with each face painted one of three colors: red, yellow, or blue, and each color is used on exactly 2 faces. When two blocks can be rotated to have the same color faces in the same positions, they are considered the same type of block. Try to explain: what is the maximum number of different types of blocks that can be painted?
5. There are 6 different types of building blocks.
5.【Solution】The bottom face can always be red.

If the top face is also red, by flipping, the front can be yellow, and the left side is not yellow. At this time, the back can be yellow or blue, which gives 2 possibilities.
If the top face is not red, by rotating, the back can be red. At this point, there are two cases:
(1) The front and the top are the same color, which can both be yellow or both be blue, giving 2 possibilities.
(2) The front and the top are different colors. By flipping, the top can be yellow, and the front can be blue. At this time, the right side can be yellow or blue, giving 2 possibilities.

Therefore, there are a total of $2+2+2=6$ different types of building blocks.