Secret Santa Sort

I finally got around to working on Brent Simmons’s challenge (or, rather, his pointer to a challenge) for implementing a Secret Santa sort. His original post is here and my Gist implementation is here. I like this solution as it effectively treats an array as a circularly linked-list in order to find a valid Santa assignment. This is meant to be run from the command line with the command cat secret_santa.txt | swift santa_sort.swift on a file like this:

Let me know if you have any suggestions or spot any errors!