Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    if command[0] == 'delete':
        for i in range(len(dll)):
            if dll[i] == command[1]: 
                dll.pop(i)
                break
    if command[0] == 'deleteFirst':
        dll.pop(0)
    if command[0] == 'deleteLast':
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
        for i in range(len(dll)):
            if dll[i] == command[1]: 
                dll.pop(i)
                break
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Runtime Error):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
       # for i in range(len(dll)):
            #if dll[i] == command[1]: 
                #dll.pop(i)
                #break
        indexes = [i for i, x in enumerate(dll) if x == command[1]]
        dll.pop(indexes[0])
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
       # for i in range(len(dll)):
            #if dll[i] == command[1]: 
                #dll.pop(i)
                #break
        indexes = [i for i, x in enumerate(dll) if x == command[1]]
        if len(indexes) != 0:
            dll.pop(indexes[0])
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Runtime Error):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
       # for i in range(len(dll)):
            #if dll[i] == command[1]: 
                #dll.pop(i)
                #break
        dll.remove(command[1])
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
        if command[1] in dll:
            dll.remove(command[1])
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Buggy python submission (verdict: Runtime Error):
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()
    print(dll[i], sep=" ")
#print(*dll)

Fixed submission:
from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)