from collections import deque
n = int(raw_input())
stack = deque()
for i in range(n):
	i = raw_input()
	if "insert" in i:
		stack.appendleft(int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.popleft()
	elif "deleteLast" in i:
		stack.pop()
print " ".join(map(str, stack)) from collections import deque n = int(raw_input()) n int(raw_input()) int raw_input() raw_input stack = deque() stack deque() deque for i in range(n):
	i = raw_input()
	if "insert" in i:
		stack.appendleft(int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.popleft()
	elif "deleteLast" in i:
		stack.pop() i range(n) range n i = raw_input() i raw_input() raw_input if "insert" in i:
		stack.appendleft(int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.popleft()
	elif "deleteLast" in i:
		stack.pop() "insert" in i "insert" i stack.appendleft(int(i[7:])) stack.appendleft stack appendleft int(i[7:]) int i[7:] i 7: 7 elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	 "delete " in i "delete " i if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	 int(i[7:]) in stack int(i[7:]) int i[7:] i 7: 7 stack stack.remove(int(i[7:])) stack.remove stack remove int(i[7:]) int i[7:] i 7: 7 elif "deleteFirst" in i:
		stack.popleft()
	 "deleteFirst" in i "deleteFirst" i stack.popleft() stack.popleft stack popleft elif "deleteLast" in i:
		stack.pop() "deleteLast" in i "deleteLast" i stack.pop() stack.pop stack pop print " ".join(map(str, stack)) " ".join " " join map(str, stack) map str stack stack = deque() deque() stack i = raw_input() raw_input() i n = int(raw_input()) int(raw_input()) n
from collections import deque
n = int(raw_input())
stack = deque()
for i in range(n):
	i = raw_input()
	if "insert" in i:
		stack.appendleft(int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.popleft()
	elif "deleteLast" in i:
		stack.pop()
print " ".join(map(str, stack))