A train passes a station A at 40 km/h

A train passes a station A at 40 km/h and maintains its speed for 7 km and is then uniformly retarded, stopping at B which is 8.5 km from A. A second train starts from A at the instant the first train passes and being accelerated some part of the journey and uniformly retarded for the rest, stops at Bat the same times as the first train. Calculate the greatest speed of the second train, use only the graphical method.