Buggy python submission (verdict: Runtime Error):
from collections import deque

if __name__ == '__main__':
    n = int(input())
    dll = deque()
    for _ in range(n):
        command = input().split()
        if command[0] == 'insert':
            dll.appendleft(command[1])
        elif command[0] == 'delete':
            dll.remove(command[1])
        elif command[0] == 'deleteFirst':
            dll.popleft()
        elif command[0] == 'deleteLast':
            dll.pop()
    print(*dll)



Fixed submission:
# -*- coding:utf-8 -*-

from collections import deque

result = deque()

def operation(command):
    if command[0] == "insert":
        result.appendleft(command[1])
    elif command[0] == "delete":
        if command[1] in result:
            result.remove(command[1])
    elif command[0] == "deleteFirst":
        result.popleft()
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)

Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

result = list()

def operation(command):
    if command[0] == "insert":
        result.insert(0, int(command[1]))
    elif command[0] == "delete":
        result.remove(int(command[1]))
    elif command[0] == "deleteFirst":
        result.pop(0)
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)

Fixed submission:
# -*- coding:utf-8 -*-

from collections import deque

result = deque()

def operation(command):
    if command[0] == "insert":
        result.appendleft(command[1])
    elif command[0] == "delete":
        if command[1] in result:
            result.remove(command[1])
    elif command[0] == "deleteFirst":
        result.popleft()
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-

result = list()

def operation(command):
    if command[0] == "insert":
        result.insert(0, int(command[1]))
    elif command[0] == "delete":
        if int(command[1]) in result:
            result.remove(int(command[1]))
    elif command[0] == "deleteFirst":
        result.pop(0)
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)

Fixed submission:
# -*- coding:utf-8 -*-

from collections import deque

result = deque()

def operation(command):
    if command[0] == "insert":
        result.appendleft(command[1])
    elif command[0] == "delete":
        if command[1] in result:
            result.remove(command[1])
    elif command[0] == "deleteFirst":
        result.popleft()
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding:utf-8 -*-

result = list()

def operation(command):
    if command[0] == "insert":
        result.insert(0, int(command[1]))
    elif command[0] == "delete":
        if int(command[1]) in result:
            result.remove(int(command[1]))
    elif command[0] == "deleteFirst":
        del result[0]
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)

Fixed submission:
# -*- coding:utf-8 -*-

from collections import deque

result = deque()

def operation(command):
    if command[0] == "insert":
        result.appendleft(command[1])
    elif command[0] == "delete":
        if command[1] in result:
            result.remove(command[1])
    elif command[0] == "deleteFirst":
        result.popleft()
    elif command[0] == "deleteLast":
        result.pop()

n = int(input())
for i in range(n):
    command = input().split()
    operation(command)
print(*result)