# Demo deque used as STACK and FIFO
# Provided  by Anthony Vogelaar, Perth Scotland
# rev 0.10  2025-07-30

from collections	import	deque

def stack():
    print('LIFO or STACK')
    q = deque((), 10)
    print('in 10'), q.append (10)
    print('in 20'), q.append (20)
    print('in 30'), q.append (30)
    print('out #1', q.pop())
    print('out #2', q.pop())
    print('out #3', q.pop())


def fifo():
    print('FIFO')
    q = deque((), 10)
    print('in 10'), q.append (10)
    print('in 20'), q.append (20)
    print('in 30'), q.append (30)
    print('out #1', q.popleft())
    print('out #2', q.popleft())
    print('out #3', q.popleft())
    

#stack()
fifo()
