Collections.deque()

  • + 0 comments
    d=deque()
    for _ in range(int(input())):
        l= input().split()
        (getattr(d, l[0])())if len(l)==1 else (getattr(d, l[0])(l[1]))
    print(' '.join(d))