Collections.deque()

  • + 0 comments
    from collections import deque
    d= deque()
    N = int(input())
    
    for inp in range(N):
        operation = input().split()
        if len(operation) == 1:
            getattr(d, operation[0])()
        else:
            getattr(d, operation[0])(operation[1])
    
    print(" ".join(d))