Use sets instead of lists for efficiency.

Also, use Python style `.format()` for string formatting.