I guess you can link them using an instance variable. So the entrance and exit have the same value at that variable. When player pass through an entrance with the variable equal to 0, he gets teleported to the exit with the variable equal to 0.
Develop games in your browser. Powerful, performant & highly capable.