from collections import deque

lst = deque()

for l in range(int(input())):
  dat_set = input().split()
  command = dat_set[0]
  try:
    if command == 'insert':
      lst.appendleft(dat_set[-1])
    elif command == 'delete':
      lst.remove(dat_set[-1])
    elif command == 'deleteFirst':
      lst.popleft()
    elif command == 'deleteLast':
      lst.pop()
  except:
    pass

print(*lst) from collections import deque lst = deque() lst deque() deque for l in range(int(input())):
  dat_set = input().split()
  command = dat_set[0]
  try:
    if command == 'insert':
      lst.appendleft(dat_set[-1])
    elif command == 'delete':
      lst.remove(dat_set[-1])
    elif command == 'deleteFirst':
      lst.popleft()
    elif command == 'deleteLast':
      lst.pop()
  except:
    pass l range(int(input())) range int(input()) int input() input dat_set = input().split() dat_set input().split() ().split () input split command = dat_set[0] command dat_set[0] dat_set 0 try:
    if command == 'insert':
      lst.appendleft(dat_set[-1])
    elif command == 'delete':
      lst.remove(dat_set[-1])
    elif command == 'deleteFirst':
      lst.popleft()
    elif command == 'deleteLast':
      lst.pop()
  except:
    pass except:
    pass if command == 'insert':
      lst.appendleft(dat_set[-1])
    elif command == 'delete':
      lst.remove(dat_set[-1])
    elif command == 'deleteFirst':
      lst.popleft()
    elif command == 'deleteLast':
      lst.pop()
   command == 'insert' command 'insert' lst.appendleft(dat_set[-1]) lst.appendleft lst appendleft dat_set[-1] dat_set -1 elif command == 'delete':
      lst.remove(dat_set[-1])
     command == 'delete' command 'delete' lst.remove(dat_set[-1]) lst.remove lst remove dat_set[-1] dat_set -1 elif command == 'deleteFirst':
      lst.popleft()
     command == 'deleteFirst' command 'deleteFirst' lst.popleft() lst.popleft lst popleft elif command == 'deleteLast':
      lst.pop()
   command == 'deleteLast' command 'deleteLast' lst.pop() lst.pop lst pop print(*lst) print *lst lst dat_set = input().split() input().split() dat_set lst = deque() deque() lst command = dat_set[0] dat_set[0] command
from collections import deque

lst = deque()

for l in range(int(input())):
  dat_set = input().split()
  command = dat_set[0]
  try:
    if command == 'insert':
      lst.appendleft(dat_set[-1])
    elif command == 'delete':
      lst.remove(dat_set[-1])
    elif command == 'deleteFirst':
      lst.popleft()
    elif command == 'deleteLast':
      lst.pop()
  except:
    pass

print(*lst)
