import sys
import collections

N = int(input())

L = collections.deque()
for _ in range(N):
    com = (sys.stdin.readline().rstrip()).split()
    if com[0] == 'insert':
        L.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            L.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        L.popleft()
    elif com[0] == 'deleteLast':
        L.pop()

print(*L) import sys sys import collections collections N = int(input()) N int(input()) int input() input L = collections.deque() L collections.deque() collections.deque collections deque for _ in range(N):
    com = (sys.stdin.readline().rstrip()).split()
    if com[0] == 'insert':
        L.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            L.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        L.popleft()
    elif com[0] == 'deleteLast':
        L.pop() _ range(N) range N com = (sys.stdin.readline().rstrip()).split() com (sys.stdin.readline().rstrip()).split() sys.stdin.readline().rstrip()).split sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip split if com[0] == 'insert':
        L.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            L.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        L.popleft()
    elif com[0] == 'deleteLast':
        L.pop() com[0] == 'insert' com[0] com 0 'insert' L.appendleft(int(com[1])) L.appendleft L appendleft int(com[1]) int com[1] com 1 elif com[0] == 'delete':
        try:
            L.remove(int(com[1]))
        except:
            pass
     com[0] == 'delete' com[0] com 0 'delete' try:
            L.remove(int(com[1]))
        except:
            pass
     except:
            pass
     L.remove(int(com[1])) L.remove L remove int(com[1]) int com[1] com 1 elif com[0] == 'deleteFirst':
        L.popleft()
     com[0] == 'deleteFirst' com[0] com 0 'deleteFirst' L.popleft() L.popleft L popleft elif com[0] == 'deleteLast':
        L.pop() com[0] == 'deleteLast' com[0] com 0 'deleteLast' L.pop() L.pop L pop print(*L) print *L L com = (sys.stdin.readline().rstrip()).split() (sys.stdin.readline().rstrip()).split() com N = int(input()) int(input()) N L = collections.deque() collections.deque() L
import sys
import collections

N = int(input())

L = collections.deque()
for _ in range(N):
    com = (sys.stdin.readline().rstrip()).split()
    if com[0] == 'insert':
        L.appendleft(int(com[1]))
    elif com[0] == 'delete':
        try:
            L.remove(int(com[1]))
        except:
            pass
    elif com[0] == 'deleteFirst':
        L.popleft()
    elif com[0] == 'deleteLast':
        L.pop()

print(*L)
