solve cakes-rows