from collections import deque
class DoublyLinkedKist:
    DLlist = deque()

    def command(self, cmd):
        if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop()

if __name__ == '__main__':
    DL = DoublyLinkedKist()
    for i in range(int(input())):
        DL.command(input().split())
    print(*DL.DLlist) from collections import deque class DoublyLinkedKist:
    DLlist = deque()

    def command(self, cmd):
        if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop() DoublyLinkedKist DLlist = deque() DLlist deque() deque def command(self, cmd):
        if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop() command if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop() cmd[0] == 'insert' cmd[0] cmd 0 'insert' self.DLlist.appendleft(cmd[1]) self.DLlist.appendleft self.DLlist self DLlist appendleft cmd[1] cmd 1 elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
         cmd[0] == 'delete' cmd[0] cmd 0 'delete' if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
         cmd[1] in self.DLlist cmd[1] cmd 1 self.DLlist self DLlist self.DLlist.remove(cmd[1]) self.DLlist.remove self.DLlist self DLlist remove cmd[1] cmd 1 elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
         cmd[0] == 'deleteFirst' cmd[0] cmd 0 'deleteFirst' self.DLlist.popleft() self.DLlist.popleft self.DLlist self DLlist popleft elif cmd[0] == 'deleteLast':
            self.DLlist.pop() cmd[0] == 'deleteLast' cmd[0] cmd 0 'deleteLast' self.DLlist.pop() self.DLlist.pop self.DLlist self DLlist pop self self cmd cmd if __name__ == '__main__':
    DL = DoublyLinkedKist()
    for i in range(int(input())):
        DL.command(input().split())
    print(*DL.DLlist) __name__ == '__main__' __name__ '__main__' DL = DoublyLinkedKist() DL DoublyLinkedKist() DoublyLinkedKist for i in range(int(input())):
        DL.command(input().split())
     i range(int(input())) range int(input()) int input() input DL.command(input().split()) DL.command DL command input().split() ().split () input split print(*DL.DLlist) print *DL.DLlist DL.DLlist DL DLlist class DoublyLinkedKist:
    DLlist = deque()

    def command(self, cmd):
        if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop() class DoublyLinkedKist:
    DLlist = deque()

    def command(self, cmd):
        if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop() DoublyLinkedKist DL = DoublyLinkedKist() DoublyLinkedKist() DL
from collections import deque
class DoublyLinkedKist:
    DLlist = deque()

    def command(self, cmd):
        if cmd[0] == 'insert':
            self.DLlist.appendleft(cmd[1])
        elif cmd[0] == 'delete':
            if cmd[1] in self.DLlist:
                self.DLlist.remove(cmd[1])
        elif cmd[0] == 'deleteFirst':
            self.DLlist.popleft()
        elif cmd[0] == 'deleteLast':
            self.DLlist.pop()

if __name__ == '__main__':
    DL = DoublyLinkedKist()
    for i in range(int(input())):
        DL.command(input().split())
    print(*DL.DLlist)