HW: trains

My trains homework implementation