from collections import deque
import sys

if __name__ == '__main__':
    n = int(input())
    d = deque()

    for command in sys.stdin.readlines():

        if command.startswith("insert"):
            d.appendleft(int(command[len("insert"):]))
        elif command.startswith("delete "):
            if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
        elif command.startswith("deleteLast"):
            d.pop()
        elif command.startswith("deleteFirst"):
            d.popleft()
        else:
            print(command)

        # print(*d, command, e)
    print(*d) from collections import deque import sys sys if __name__ == '__main__':
    n = int(input())
    d = deque()

    for command in sys.stdin.readlines():

        if command.startswith("insert"):
            d.appendleft(int(command[len("insert"):]))
        elif command.startswith("delete "):
            if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
        elif command.startswith("deleteLast"):
            d.pop()
        elif command.startswith("deleteFirst"):
            d.popleft()
        else:
            print(command)

        # print(*d, command, e)
    print(*d) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input d = deque() d deque() deque for command in sys.stdin.readlines():

        if command.startswith("insert"):
            d.appendleft(int(command[len("insert"):]))
        elif command.startswith("delete "):
            if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
        elif command.startswith("deleteLast"):
            d.pop()
        elif command.startswith("deleteFirst"):
            d.popleft()
        else:
            print(command)

        # print(*d, command, e)
     command sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines if command.startswith("insert"):
            d.appendleft(int(command[len("insert"):]))
        elif command.startswith("delete "):
            if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
        elif command.startswith("deleteLast"):
            d.pop()
        elif command.startswith("deleteFirst"):
            d.popleft()
        else:
            print(command)

        # print(*d, command, e)
     command.startswith("insert") command.startswith command startswith "insert" d.appendleft(int(command[len("insert"):])) d.appendleft d appendleft int(command[len("insert"):]) int command[len("insert"):] command len("insert"): len("insert") len "insert" elif command.startswith("delete "):
            if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
         command.startswith("delete ") command.startswith command startswith "delete " if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
         int(command[len("delete"):]) in d int(command[len("delete"):]) int command[len("delete"):] command len("delete"): len("delete") len "delete" d d.remove(int(command[-2])) d.remove d remove int(command[-2]) int command[-2] command -2 elif command.startswith("deleteLast"):
            d.pop()
         command.startswith("deleteLast") command.startswith command startswith "deleteLast" d.pop() d.pop d pop elif command.startswith("deleteFirst"):
            d.popleft()
         command.startswith("deleteFirst") command.startswith command startswith "deleteFirst" d.popleft() d.popleft d popleft print(command) print command print(*d) print *d d n = int(input()) int(input()) n d = deque() deque() d
from collections import deque
import sys

if __name__ == '__main__':
    n = int(input())
    d = deque()

    for command in sys.stdin.readlines():

        if command.startswith("insert"):
            d.appendleft(int(command[len("insert"):]))
        elif command.startswith("delete "):
            if int(command[len("delete"):]) in d:
                d.remove(int(command[-2]))
        elif command.startswith("deleteLast"):
            d.pop()
        elif command.startswith("deleteFirst"):
            d.popleft()
        else:
            print(command)

        # print(*d, command, e)
    print(*d)
