Solution for trains problem