#alds13c
from collections import deque
class DoubleLinkyList:
    def __init__(self):
        self.lst=[]
    def insert(self,x):
        self.lst.insert(0,x)
    def delete_x(self,x):
        if x in self.lst:
            self.lst.pop(self.lst.index(x))
    def deleteFirst(self):
        self.lst.pop(0)
    def deleteLast(self):
        self.lst.pop(-1)
        
n = int(input())
dll = deque()

for i in range(n):
    A = input().split(" ")
    if A[0] == "insert":
        dll.appendleft((A[1]))
        #continue
    if A[0] == "delete" and A[1] in dll:
        dll.remove((A[1]))
    if A[0]=="deleteFirst":
        dll.popleft()
    if A[0]=="deleteLast":
        dll.pop()

result = list(dll)
print(" ".join(result))
#print(dll) from collections import deque class DoubleLinkyList:
    def __init__(self):
        self.lst=[]
    def insert(self,x):
        self.lst.insert(0,x)
    def delete_x(self,x):
        if x in self.lst:
            self.lst.pop(self.lst.index(x))
    def deleteFirst(self):
        self.lst.pop(0)
    def deleteLast(self):
        self.lst.pop(-1)
         DoubleLinkyList def __init__(self):
        self.lst=[]
     __init__ self.lst=[] self.lst self lst [] self self def insert(self,x):
        self.lst.insert(0,x)
     insert self.lst.insert(0,x) self.lst.insert self.lst self lst insert 0 x self self x x def delete_x(self,x):
        if x in self.lst:
            self.lst.pop(self.lst.index(x))
     delete_x if x in self.lst:
            self.lst.pop(self.lst.index(x))
     x in self.lst x self.lst self lst self.lst.pop(self.lst.index(x)) self.lst.pop self.lst self lst pop self.lst.index(x) self.lst.index self.lst self lst index x self self x x def deleteFirst(self):
        self.lst.pop(0)
     deleteFirst self.lst.pop(0) self.lst.pop self.lst self lst pop 0 self self def deleteLast(self):
        self.lst.pop(-1)
         deleteLast self.lst.pop(-1) self.lst.pop self.lst self lst pop -1 self self n = int(input()) n int(input()) int input() input dll = deque() dll deque() deque for i in range(n):
    A = input().split(" ")
    if A[0] == "insert":
        dll.appendleft((A[1]))
        #continue
    if A[0] == "delete" and A[1] in dll:
        dll.remove((A[1]))
    if A[0]=="deleteFirst":
        dll.popleft()
    if A[0]=="deleteLast":
        dll.pop() i range(n) range n A = input().split(" ") A input().split(" ") ().split () input split " " if A[0] == "insert":
        dll.appendleft((A[1]))
        #continue
     A[0] == "insert" A[0] A 0 "insert" dll.appendleft((A[1])) dll.appendleft dll appendleft A[1] A 1 if A[0] == "delete" and A[1] in dll:
        dll.remove((A[1]))
     A[0] == "delete" and A[1] in dll A[0] == "delete" A[0] A 0 "delete" A[1] in dll A[1] A 1 dll dll.remove((A[1])) dll.remove dll remove A[1] A 1 if A[0]=="deleteFirst":
        dll.popleft()
     A[0]=="deleteFirst" A[0] A 0 "deleteFirst" dll.popleft() dll.popleft dll popleft if A[0]=="deleteLast":
        dll.pop() A[0]=="deleteLast" A[0] A 0 "deleteLast" dll.pop() dll.pop dll pop result = list(dll) result list(dll) list dll print(" ".join(result)) print " ".join(result) " ".join " " join result class DoubleLinkyList:
    def __init__(self):
        self.lst=[]
    def insert(self,x):
        self.lst.insert(0,x)
    def delete_x(self,x):
        if x in self.lst:
            self.lst.pop(self.lst.index(x))
    def deleteFirst(self):
        self.lst.pop(0)
    def deleteLast(self):
        self.lst.pop(-1)
         class DoubleLinkyList:
    def __init__(self):
        self.lst=[]
    def insert(self,x):
        self.lst.insert(0,x)
    def delete_x(self,x):
        if x in self.lst:
            self.lst.pop(self.lst.index(x))
    def deleteFirst(self):
        self.lst.pop(0)
    def deleteLast(self):
        self.lst.pop(-1)
         DoubleLinkyList dll = deque() deque() dll n = int(input()) int(input()) n A = input().split(" ") input().split(" ") A result = list(dll) list(dll) result
#alds13c
from collections import deque
class DoubleLinkyList:
    def __init__(self):
        self.lst=[]
    def insert(self,x):
        self.lst.insert(0,x)
    def delete_x(self,x):
        if x in self.lst:
            self.lst.pop(self.lst.index(x))
    def deleteFirst(self):
        self.lst.pop(0)
    def deleteLast(self):
        self.lst.pop(-1)
        
n = int(input())
dll = deque()

for i in range(n):
    A = input().split(" ")
    if A[0] == "insert":
        dll.appendleft((A[1]))
        #continue
    if A[0] == "delete" and A[1] in dll:
        dll.remove((A[1]))
    if A[0]=="deleteFirst":
        dll.popleft()
    if A[0]=="deleteLast":
        dll.pop()

result = list(dll)
print(" ".join(result))
#print(dll)
