Two way electrical switches have two types of wires connected to them: common wires and traveler wires. The common wire is the only wire that needs to be attached to a particular screw, often the dark one, on the 2-way switch.
While the common wire must be connected in a specific location on the two way switch, the traveler wires may be connected to either of the remaining terminals. Location does not matter.
It is important to mark the common wire before unhooking it from the old switch. That way the common wire may be easily identified when attaching it to the new 2-way switch.