eliminate one deque and add a set for discarded items within one iteration