The train was invented before the bicycle
When you look at the history of the bicycle, the first two-wheeler used by humans was the Draisine which was invented and patented in February 1818 by Karl Drais of Germany. On the other hand, rail transport might date back to the ancient Greeks. The first mechanised railroad system, i.e the steam engine, was started in England in the 1820s. Before the steam engines, wagon-ways were used in mining. Thus, surprisingly men knew how to drive a rail engine before being able to balance himself on two wheeler.