There is a system like this:
The player connected to the first Gate now which has an unique id to distinguish from other gates. The player now can interchange with B