Stacking Boxes problem solution