Buggy python submission (verdict: Runtime Error):
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, i[7:])
	elif "delete " in i:
		stack.remove(i[7:])
	elif "deleteFirst" in i:
		stack.pop(0)
	elif "deleteLast" in i:
		stack.pop()
print " ".join(stack)

Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, i[7:])
	elif "delete " in i:
		stack.remove(i[7:])
	elif "deleteFirst" in i:
		stack.pop(0)
	elif "deleteLast" in i:
		stack.pop()
print " ".join(stack)

Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, i[7:])
	elif "delete " in i and len(stack) > 0:
		stack.remove(i[7:])
	elif "deleteFirst" in i and len(stack) > 0:
		stack.pop(0)
	elif "deleteLast" in i and len(stack) > 0:
		stack.pop()
print " ".join(stack)

Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, i[7:])
	elif "delete " in i and len(stack) > 0:
		stack.remove(i[7:])
	elif "deleteFirst" in i and len(stack) > 0:
		stack.pop(0)
	elif "deleteLast" in i and len(stack) > 0:
		stack.pop()
if len(stack) > 0:
    print " ".join(stack)

Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, int(i[7:]))
	elif "delete " in i and len(stack) > 0:
		stack.remove(int(i[7:]))
	elif "deleteFirst" in i and len(stack) > 0:
		stack.pop(0)
	elif "deleteLast" in i and len(stack) > 0:
		stack.pop()
if len(stack) > 0:
    print " ".join(map(str, stack))

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		try:
		    stack.insert(0, int(i[7:]))
		except:
			pass
	elif "delete " in i and len(stack) > 0:
		try:
		    stack.remove(int(i[7:]))
		except:
			pass
	elif "deleteFirst" in i and len(stack) > 0:
		stack.pop(0)
	elif "deleteLast" in i and len(stack) > 0:
		stack.pop()
if len(stack) > 0:
    print " ".join(map(str, stack))

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):

n = int(raw_input())
stack = []
for i in range(n):
	i = raw_input()
	if "insert" in i:
		try:
		    stack.insert(0, int(i[7:]))
		except:
			pass
	elif "delete " in i and len(stack) > 0:
		try:
		    stack.remove(int(i[7:]))
		except:
			pass
	elif "deleteFirst" in i and len(stack) > 0:
		stack.pop(0)
	elif "deleteLast" in i and len(stack) > 0:
		stack.pop()
if len(stack) > 0:
    print " ".join(map(str, stack))

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):

n = int(raw_input())
stack = []
for i in range(n):
	i = raw_input()
	if "insert" in i:
		try:
		    stack.insert(0, int(i[7:]))
		except:
			pass
	elif "delete " in i:
		try:
		    stack.remove(int(i[7:]))
		except:
			pass
	elif "deleteFirst" in i:
		stack.pop(0)
	elif "deleteLast" in i:
		stack.pop()
if len(stack) > 0:
    print " ".join(map(str, stack))

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):

n = int(raw_input())
stack = []
for i in range(n):
	i = raw_input()
	if "insert" in i:
		try:
		    stack.insert(0, int(i[7:]))
		except:
			pass
	elif "delete " in i:
		try:
		    stack.remove(int(i[7:]))
		except:
			pass
	elif "deleteFirst" in i:
		stack.pop(0)
	elif "deleteLast" in i:
		stack.pop()
print " ".join(map(str, stack))

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):

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

Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(raw_input())
stack = deque()
for i in range(n):
	i = raw_input()
	if "insert" in i:
		stack.insert(0, int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.pop(0)
	elif "deleteLast" in i:
		stack.pop()
print " ".join(map(str, stack))

Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(raw_input())
stack = []
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))

Fixed submission:
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))