added definition to check if train runs on same line