Introduction - If you have any usage issues, please Google them yourself
First, the problem
A train to N train cars were sent to the N station, the station in 1 ~ N order number, the train in accordance with the N, N-1 ... 1 the number of order through the station. Pretend the train number is the number of its destination station.
Second, the requirements
Given an arbitrary arrangement of the order. Rearrange the cars so that they are in the order of 1 to N. Requires rearrangement only the track into the buffer rail, or the buffer rail to the derailment.