#the cube logic