Sorting Balls Puzzle