Use set/deque combo to make 'x in queue' run in constant time