from collections import deque
import sys

dlist = deque()

func = {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop}

n = int(sys.stdin.readline())

for line in sys.stdin:
    command = line.split()
    if len(command) == 2:
        command[1] = int(command[1])
    try:
        func[command[0]](*command[1:])
    except ValueError:
        pass

print(*dlist) from collections import deque import sys sys dlist = deque() dlist deque() deque func = {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop} func {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop} 'insert' 'insert' dlist.appendleft dlist appendleft 'delete' 'delete' dlist.remove dlist remove 'deleteFirst' 'deleteFirst' dlist.popleft dlist popleft 'deleteLast' 'deleteLast' dlist.pop dlist pop n = int(sys.stdin.readline()) n int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline for line in sys.stdin:
    command = line.split()
    if len(command) == 2:
        command[1] = int(command[1])
    try:
        func[command[0]](*command[1:])
    except ValueError:
        pass line sys.stdin sys stdin command = line.split() command line.split() line.split line split if len(command) == 2:
        command[1] = int(command[1])
     len(command) == 2 len(command) len command 2 command[1] = int(command[1]) command[1] command 1 int(command[1]) int command[1] command 1 try:
        func[command[0]](*command[1:])
    except ValueError:
        pass except ValueError:
        pass func[command[0]](*command[1:]) [command[0]] func command[0] command 0 *command[1:] command[1:] command 1: 1 print(*dlist) print *dlist dlist command = line.split() line.split() command func = {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop} {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop} func n = int(sys.stdin.readline()) int(sys.stdin.readline()) n dlist = deque() deque() dlist
from collections import deque
import sys

dlist = deque()

func = {'insert':dlist.appendleft, 'delete':dlist.remove, 'deleteFirst':dlist.popleft, 'deleteLast':dlist.pop}

n = int(sys.stdin.readline())

for line in sys.stdin:
    command = line.split()
    if len(command) == 2:
        command[1] = int(command[1])
    try:
        func[command[0]](*command[1:])
    except ValueError:
        pass

print(*dlist)