from collections import deque
que = deque()
for _ in range(int(input())):
    op, v = (input().split() + ["1"])[:2]
    if op == "insert":
        que.appendleft(v)
    elif op == "delete":
        try:
            que.remove(v)
        except:
            pass
    elif op == "deleteFirst":
        que.popleft()
    elif op == "deleteLast":
        que.pop()
print(' '.join(que))      from collections import deque que = deque() que deque() deque for _ in range(int(input())):
    op, v = (input().split() + ["1"])[:2]
    if op == "insert":
        que.appendleft(v)
    elif op == "delete":
        try:
            que.remove(v)
        except:
            pass
    elif op == "deleteFirst":
        que.popleft()
    elif op == "deleteLast":
        que.pop() _ range(int(input())) range int(input()) int input() input op, v = (input().split() + ["1"])[:2] op (input().split() + ["1"])[:2] input().split() + ["1"] input().split() ().split () input split ["1"] "1" :2 2 v if op == "insert":
        que.appendleft(v)
    elif op == "delete":
        try:
            que.remove(v)
        except:
            pass
    elif op == "deleteFirst":
        que.popleft()
    elif op == "deleteLast":
        que.pop() op == "insert" op "insert" que.appendleft(v) que.appendleft que appendleft v elif op == "delete":
        try:
            que.remove(v)
        except:
            pass
     op == "delete" op "delete" try:
            que.remove(v)
        except:
            pass
     except:
            pass
     que.remove(v) que.remove que remove v elif op == "deleteFirst":
        que.popleft()
     op == "deleteFirst" op "deleteFirst" que.popleft() que.popleft que popleft elif op == "deleteLast":
        que.pop() op == "deleteLast" op "deleteLast" que.pop() que.pop que pop print(' '.join(que)) print ' '.join(que) ' '.join ' ' join que que = deque() deque() que op, v = (input().split() + ["1"])[:2] (input().split() + ["1"])[:2] op v = (input().split() + ["1"])[:2] (input().split() + ["1"])[:2] v
from collections import deque
que = deque()
for _ in range(int(input())):
    op, v = (input().split() + ["1"])[:2]
    if op == "insert":
        que.appendleft(v)
    elif op == "delete":
        try:
            que.remove(v)
        except:
            pass
    elif op == "deleteFirst":
        que.popleft()
    elif op == "deleteLast":
        que.pop()
print(' '.join(que))     
