#ALDS1_3-C Elementary data structures - Doubly Linked List
import collections
q = collections.deque()
cmds={"insert":lambda cmd: q.appendleft(cmd[1]),
      "delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
      "deleteFirst":lambda cmd: q.popleft(),
      "deleteLast": lambda cmd: q.pop()
     }

n=int(input())
for i in range(n):
    cmd=input().split()
    cmds[cmd[0]](cmd)
print(*q) import collections collections q = collections.deque() q collections.deque() collections.deque collections deque cmds={"insert":lambda cmd: q.appendleft(cmd[1]),
      "delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
      "deleteFirst":lambda cmd: q.popleft(),
      "deleteLast": lambda cmd: q.pop()
     } cmds {"insert":lambda cmd: q.appendleft(cmd[1]),
      "delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
      "deleteFirst":lambda cmd: q.popleft(),
      "deleteLast": lambda cmd: q.pop()
     } "insert" "insert" lambda cmd: q.appendleft(cmd[1]) q.appendleft(cmd[1]) q.appendleft q appendleft cmd[1] cmd 1 cmd "delete" "delete" lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none" q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none" q.count(cmd[1]) > 0 q.count(cmd[1]) q.count q count cmd[1] cmd 1 0 q.remove(cmd[1]) q.remove q remove cmd[1] cmd 1 "none" cmd "deleteFirst" "deleteFirst" lambda cmd: q.popleft() q.popleft() q.popleft q popleft cmd "deleteLast" "deleteLast" lambda cmd: q.pop() q.pop() q.pop q pop cmd n=int(input()) n int(input()) int input() input for i in range(n):
    cmd=input().split()
    cmds[cmd[0]](cmd) i range(n) range n cmd=input().split() cmd input().split() ().split () input split cmds[cmd[0]](cmd) [cmd[0]] cmds cmd[0] cmd 0 cmd print(*q) print *q q q = collections.deque() collections.deque() q cmd=input().split() input().split() cmd cmds={"insert":lambda cmd: q.appendleft(cmd[1]),
      "delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
      "deleteFirst":lambda cmd: q.popleft(),
      "deleteLast": lambda cmd: q.pop()
     } {"insert":lambda cmd: q.appendleft(cmd[1]),
      "delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
      "deleteFirst":lambda cmd: q.popleft(),
      "deleteLast": lambda cmd: q.pop()
     } cmds n=int(input()) int(input()) n
#ALDS1_3-C Elementary data structures - Doubly Linked List
import collections
q = collections.deque()
cmds={"insert":lambda cmd: q.appendleft(cmd[1]),
      "delete":lambda cmd: q.remove(cmd[1]) if (q.count(cmd[1]) > 0) else "none",
      "deleteFirst":lambda cmd: q.popleft(),
      "deleteLast": lambda cmd: q.pop()
     }

n=int(input())
for i in range(n):
    cmd=input().split()
    cmds[cmd[0]](cmd)
print(*q)