A Wiry Problem

Let's call the five wires A, B, C, D, E.  On the ground floor, Colin twists together two pairs of wires, leaving one wire on its own and labelling it E.  Then he goes upstairs and uses the continuity tester to find the two pairs of connected wires, and then he labels one pair A and B while the other pair is C and D, and the odd wire is of course E.  Then he joins wire B to wire C, and D to E, before going back down to the ground floor.

Back downstairs, he untwists the wires.  He then finds the wire that was left on its own at the top, labelling it A and the other wire he has just untwisted it from as B.  Finally, the wire that is connected to B is C, and the remaining one D.