>>> import collections
>>>
>>> lst = [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> n = 5
>>>
>>> deq = collections.deque(enumerate(lst))
>>>
>>> while len(deq) > 1:
... deq.rotate(-n)
... print(deq.pop())
...
(4, 5)
(0, 1)
(6, 7)
(3, 4)
(2, 3)
(5, 6)
(8, 9)
(1, 2)
>>> print(deq)
deque([(7, 8)])
>>>