They are returned to the top of deck. They are only discarded if a game rule would force them to exist together, not an ability. All duplicates are protected from being put in play/set-aside by an ability.
Example of a game rule that could cause discard:
I have Moses and AutO out. My opponent bands to my AutO with Simeon, then exchanges for Moses. Exchange also exchanges permanent control of the characters, so my opponent now controls AutO (though if they exchanged to hand/deck it still goes to mine by game rule) and I permanently control that Moses, even though my opponent is currently using it in battle.
After battle, Moses tries to come back to me due to game rule. I already have one, so this new one is discarded.