Python Solution Block Cube Puzzle