From Wikipedia:
The "Instant Insanity" puzzle consists of four cubes with faces colored with four colors (commonly red, blue, green, and white). The objective of the puzzle is to stack these cubes in a column so that each side (front, back, left, and right) of the stack shows each of the four colors.
The Wikipedia page discusses a solution to the puzzle using graph theory. The graph theoretic solution is also discussed in Chapter 8 of Arthur Benjamin, Gary Chartrand, and Ping Zhang's "The Fascinating World of Graph Theory" (Princeton University Press, 2015).