The correct answer is "Did".

"Did" is the past tense of the verb "do". It is used to ask questions about past events. In the sentence "Did they come by train?", the speaker is asking whether the people in question came by train in the past. The answer "No, they came by plane" confirms that they did not come by train.

The other options are not correct because they are not the past tense of the verb "do". "Do" is used to ask questions about the present or future. "Does" is used to ask questions about the present tense when the subject is a singular noun or pronoun. "Were" is used to ask questions about the past tense when the subject is a plural noun or pronoun.