Numbered balls are connected to each other with elastic ropes. Restore the numbers to the correct positions with considering the connections.