This article shows how to implement the set built-in at the expense of a dictionary.
Grab a piece of paper and try to fold your way out of this problem.