What about cycles?
Add one line that loops back: Zhongshan → Taipei Main Station.
Now reach("Taipei Main Station", Y) also holds when Y is Taipei Main Station.
A cycle does not cause an infinite loop.
Datalog works with sets: once a fact is known, deriving it again adds nothing, so the rounds still stop and evaluation terminates.