The standard format of an image list file for classification is:
<path/to/image> <class index>
This way, each image is bound to the class it belongs. Somewhere you can keep class descriptions, binding indices with class names - but the idea is, following the example from your original post, that the image "ILSVRC2012_val_00000001.JPEG" belongs to class 65. I admit I don't understand what do you mean by "no correlation between how each row is written in test, train and val txt files" - the format should stay the same in each file: filename, space, class id.