$\begingroup$

I searched but there's not much useful information. My instinct is that it is not possible, but I don't know how to show it.

To make it clear, there are $27$ unit cubes, that is, $6\times27$ sides to be colored with blue, green, or red. Then you need to arrange them so that they form a $3\times3\times3$ cube, whose surfaces are blue. Then you rearrange unit cubes, so that they form a $3\times3\times3$ cube, whose surfaces are green. Then you rearrange them again, this time get a red $3\times3\times3$ cube.

More generally, can you color $n^3$ unit cubes with $n$ colors, so that after arraging, they can form $n$ $n\times n\times n$cubes, each cube's surfaces is in a different color?

When $n=1,2$, the answer is yes and the solution is obvious. But when $n$ is bigger, the problem seems complex, and I totally have no clue.