Solution to SecretSanta problem