use set instead of list for O(1) lookup