from collections import deque

n = int(input())
d = deque()
for i in range(n):
    tmp = input().split()
    ope = tmp[0]
    if ope == "insert":
        m = tmp[1]
        d.appendleft(m)
    elif ope == "delete":
        m = tmp[1]
        if m in d:
            d.remove(m)
    elif ope == "deleteFirst":
        d.popleft()
    elif ope == "deleteLast":
        d.pop()
print(*d) from collections import deque n = int(input()) n int(input()) int input() input d = deque() d deque() deque for i in range(n):
    tmp = input().split()
    ope = tmp[0]
    if ope == "insert":
        m = tmp[1]
        d.appendleft(m)
    elif ope == "delete":
        m = tmp[1]
        if m in d:
            d.remove(m)
    elif ope == "deleteFirst":
        d.popleft()
    elif ope == "deleteLast":
        d.pop() i range(n) range n tmp = input().split() tmp input().split() ().split () input split ope = tmp[0] ope tmp[0] tmp 0 if ope == "insert":
        m = tmp[1]
        d.appendleft(m)
    elif ope == "delete":
        m = tmp[1]
        if m in d:
            d.remove(m)
    elif ope == "deleteFirst":
        d.popleft()
    elif ope == "deleteLast":
        d.pop() ope == "insert" ope "insert" m = tmp[1] m tmp[1] tmp 1 d.appendleft(m) d.appendleft d appendleft m elif ope == "delete":
        m = tmp[1]
        if m in d:
            d.remove(m)
     ope == "delete" ope "delete" m = tmp[1] m tmp[1] tmp 1 if m in d:
            d.remove(m)
     m in d m d d.remove(m) d.remove d remove m elif ope == "deleteFirst":
        d.popleft()
     ope == "deleteFirst" ope "deleteFirst" d.popleft() d.popleft d popleft elif ope == "deleteLast":
        d.pop() ope == "deleteLast" ope "deleteLast" d.pop() d.pop d pop print(*d) print *d d ope = tmp[0] tmp[0] ope m = tmp[1] tmp[1] m n = int(input()) int(input()) n d = deque() deque() d m = tmp[1] tmp[1] m tmp = input().split() input().split() tmp
from collections import deque

n = int(input())
d = deque()
for i in range(n):
    tmp = input().split()
    ope = tmp[0]
    if ope == "insert":
        m = tmp[1]
        d.appendleft(m)
    elif ope == "delete":
        m = tmp[1]
        if m in d:
            d.remove(m)
    elif ope == "deleteFirst":
        d.popleft()
    elif ope == "deleteLast":
        d.pop()
print(*d)