use collections.deque