Connect the Cubes in 3 Dimensions. The connecting path cannot change direction for more than 2 times.
https://cdn.htmlgames.com/ConnectDimensions/index.html