Suppose you have a set of 27 unpainted unit cubes. You want to paint them using three different colours (red, green, and purple). You can colour each face of each cube individually (that is, the same unit cube might be multiple colours). You want the colouring done in such a way that after the painting is done, you can assemble a larger 3×3 cube using all 27 unit cubes in three different ways:

such that the entire outside of the larger cube is red.

such that the entire outside of the larger cube is green.

such that the entire outside of the larger cube is purple.

Our goal is to find all the ways we can allocate the initial painting of colours to the unit cubes such that this feat is possible.

(Note: We are just counting the way of allocating the colours, not different ways of placing the colours on a particular cube. For example, if a cube has 3 red sides, 2 green sides, and 1 purple side, there may be multiple ways of placing those colours on a particular cube, but we’re not including that in our count.)