You have four colored cubes. Each side of each cube is a single color, and there are four colors: blue (B), red (R), green (G) and yellow (Y) Describing the six faces as front, back, left, right, top, bottom, the cube colors are: 
Cube Front Back Left Right Top Bottom 
1 R B G Y B Y 
2 R G G Y B B 
3 Y B R G Y R 
4 Y G B R R R 
The objective is to find ways to stack the four cubes as a vertical column so that each side of the column is showing all four colors. 
In a compiled language of your choice, need a program to find all successful permutations.