Generate ID for each train