Use sets so __contains__ is faster.