.
Railway Line

Answer :

Only six reversals are necessary. 
The white train (from A to D) is divided into three sections, engine and 7 wagons, 8 wagons, and 1 wagon. 
The black train (D to A) never uncouples anything throughout. Fig. 1 is original position with 8 and 1 uncoupled. 
The black train proceeds to position in Fig. 2 (no reversal). 
The engine and 7 proceed towards D, and black train backs, leaves 8 on loop, and takes up position in Fig. 3 (first reversal). 
Black train goes to position in Fig. 4 to fetch single wagon (second reversal). 
Black train pushes 8 off loop and leaves single wagon there, proceeding on its journey, as in Fig. 5 (third and fourth reversals). White train now backs on to loop to pick up single car and goes right away to D (fifth and sixth reversals).





Math Genius