#ALDS1_3-C Elementary data structures - Doubly Linked List
import collections
import sys
q = collections.deque()
n=int(input())
_input = sys.stdin.readlines()
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()
     }

for i in range(n):
    cmd=_input[i].split()
    cmds[cmd[0]](cmd)
print(*q) import collections collections import sys sys q = collections.deque() q collections.deque() collections.deque collections deque n=int(input()) n int(input()) int input() input _input = sys.stdin.readlines() _input sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines 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 for i in range(n):
    cmd=_input[i].split()
    cmds[cmd[0]](cmd) i range(n) range n cmd=_input[i].split() cmd _input[i].split() [i].split [i] _input i split cmds[cmd[0]](cmd) [cmd[0]] cmds cmd[0] cmd 0 cmd print(*q) print *q q n=int(input()) int(input()) n cmd=_input[i].split() _input[i].split() cmd q = collections.deque() collections.deque() q 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 _input = sys.stdin.readlines() sys.stdin.readlines() _input
#ALDS1_3-C Elementary data structures - Doubly Linked List
import collections
import sys
q = collections.deque()
n=int(input())
_input = sys.stdin.readlines()
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()
     }

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