You may have noticed that the rails in the previous example were symmetric.
Moreover the starting position and the ending position were mirrors of each other under this symmetry.
That means, that we can succeed provided we can transform the starting position into a position symmetric to itself,
like the grey one shown in the applet below. Try to transform the blue starting position into the grey one.
Then you can also do the previous example.