Collections.deque()

  • + 0 comments

    from collections import deque n = int(input()) d = deque()

    for _ in range(n): command = input().strip().split() method = getattr(d,command[0]) if len(command)==2: method(command[1]) else: method() for i in d: print(i,end=' ')