solution for cubes problem