"two prophets who had lived long ago, Elijah and Moses, appeared"
The word "they" refers to Elijah and Moses.