Flexible passage of locomotives