from collections import deque

n = int( raw_input( ) )
que = deque( )
for i in range( n ):
	op = raw_input( ).split( " " )
	if "insert" == op[0]:
		que.appendleft( op[1] )
	elif "delete" == op[0]:
		if op[1] in que:
			que.remove( op[1] )
	elif "deleteFirst" == op[0] :
		que.popleft( )
	elif "deleteLast" == op[0]:
		que.pop( )

print( " ".join( que ) ) from collections import deque n = int( raw_input( ) ) n int( raw_input( ) ) int raw_input( ) raw_input que = deque( ) que deque( ) deque for i in range( n ):
	op = raw_input( ).split( " " )
	if "insert" == op[0]:
		que.appendleft( op[1] )
	elif "delete" == op[0]:
		if op[1] in que:
			que.remove( op[1] )
	elif "deleteFirst" == op[0] :
		que.popleft( )
	elif "deleteLast" == op[0]:
		que.pop( ) i range( n ) range n op = raw_input( ).split( " " ) op raw_input( ).split( " " ) ( ).split ( ) raw_input split " " if "insert" == op[0]:
		que.appendleft( op[1] )
	elif "delete" == op[0]:
		if op[1] in que:
			que.remove( op[1] )
	elif "deleteFirst" == op[0] :
		que.popleft( )
	elif "deleteLast" == op[0]:
		que.pop( ) "insert" == op[0] "insert" op[0] op 0 que.appendleft( op[1] ) que.appendleft que appendleft op[1] op 1 elif "delete" == op[0]:
		if op[1] in que:
			que.remove( op[1] )
	 "delete" == op[0] "delete" op[0] op 0 if op[1] in que:
			que.remove( op[1] )
	 op[1] in que op[1] op 1 que que.remove( op[1] ) que.remove que remove op[1] op 1 elif "deleteFirst" == op[0] :
		que.popleft( )
	 "deleteFirst" == op[0] "deleteFirst" op[0] op 0 que.popleft( ) que.popleft que popleft elif "deleteLast" == op[0]:
		que.pop( ) "deleteLast" == op[0] "deleteLast" op[0] op 0 que.pop( ) que.pop que pop print( " ".join( que ) ) print " ".join( que ) " ".join " " join que op = raw_input( ).split( " " ) raw_input( ).split( " " ) op n = int( raw_input( ) ) int( raw_input( ) ) n que = deque( ) deque( ) que
from collections import deque

n = int( raw_input( ) )
que = deque( )
for i in range( n ):
	op = raw_input( ).split( " " )
	if "insert" == op[0]:
		que.appendleft( op[1] )
	elif "delete" == op[0]:
		if op[1] in que:
			que.remove( op[1] )
	elif "deleteFirst" == op[0] :
		que.popleft( )
	elif "deleteLast" == op[0]:
		que.pop( )

print( " ".join( que ) )