I find it odd that the train ticket didn't get you to your final destination. If the train doesn't travel on some part of the route, the railway company usually gets you on a bus for that part and you don't have to do anything. Just get off the train and hop in the bus.
N.B. Hungary has been an EU member since 2004, but Serbia is still not.
N.B. Hungary has been an EU member since 2004, but Serbia is still not.