Exact matching, not repeated guessing until timeout
The algorithm builds allowed giver-to-recipient links and finds a complete bipartite matching with augmenting paths. Giver and candidate orders are randomized using the browser’s secure random source. It either finds a valid complete assignment or proves that the entered restrictions cannot be satisfied. A single person with no options receives an ID-specific message; shared recipient bottlenecks can also make the group impossible even when everyone has an option. The completed mapping is independently checked for one incoming and outgoing gift per person, no self picks and no excluded pair.