Buggy python submission (verdict: Time Limit Exceeded):
class LinkedListNode:
    def __init__(self, key, prev_node, next_node):
        self.key = key
        self.prev_node = prev_node
        self.next_node = next_node

class LinkedList:
    def __init__(self):
        self.front_node = None
        self.last_node = None
        self.size = 0

    def insert(self, key):
        new_node = LinkedListNode(key, None, self.front_node)
        if self.front_node != None:
            self.front_node.prev_node = new_node
        self.front_node = new_node
        if self.last_node == None:
            self.last_node = new_node
        self.size += 1

    def delete(self, key):
        node = self.front_node
        while node != None:
            if node.key == key:
                if node == self.front_node:
                    self.front_node = self.front_node.next_node
                if node == self.last_node:
                    self.last_node = self.last_node.prev_node
                if node.prev_node != None:
                    node.prev_node.next_node = node.next_node
                if node.next_node != None:
                    node.next_node.prev_node = node.prev_node
                self.size -= 1
                break
            node = node.next_node

    def delete_first(self):
        if self.size == 0:
            return
        elif self.size == 1:
            self.front_node = None
            self.last_node = None
            self.size -= 1
        else:
            self.front_node = self.front_node.next_node
            self.front_node.prev_node = None
            self.size -= 1

    def delete_last(self):
        if self.size == 0:
            return
        elif self.size == 1:
            self.front_node = None
            self.last_node = None
            self.size -= 1
        else:
            self.last_node = self.last_node.prev_node
            self.last_node.next_node = None
            self.size -= 1

    def to_a(self):
        a = []
        node = self.front_node
        while node != None:
            a.append(node.key)
            node = node.next_node
        return a

l = LinkedList()
n = int(input())
for i in range(n):
    ins = input().split()
    command = ins[0]
    if command == "insert":
        x = int(ins[1])
        l.insert(x)
    elif command == "delete":
        x = int(ins[1])
        l.delete(x)
    elif command == "deleteFirst":
        l.delete_first()
    elif command == "deleteLast":
        l.delete_last()

print(" ".join(map(str, l.to_a())))

Fixed submission:
import sys
from collections import deque

d = deque()
n = int(input())
lines = sys.stdin.readlines()
for i in range(n):
    ins = lines[i].split()
    command = ins[0]
    if command == "insert":
        d.appendleft(ins[1])
    elif command == "delete":
        try:
            d.remove(ins[1])
        except:
            pass
    elif command == "deleteFirst":
        d.popleft()
    elif command == "deleteLast":
        d.pop()

print(" ".join(d))

Buggy python submission (verdict: Time Limit Exceeded):
import sys

class LinkedListNode:
    def __init__(self, key, prev_node, next_node):
        self.key = key
        self.prev_node = prev_node
        self.next_node = next_node

class LinkedList:
    def __init__(self):
        self.front_node = None
        self.last_node = None
        self.size = 0

    def insert(self, key):
        new_node = LinkedListNode(key, None, self.front_node)
        if self.front_node != None:
            self.front_node.prev_node = new_node
        self.front_node = new_node
        if self.last_node == None:
            self.last_node = new_node
        self.size += 1

    def delete(self, key):
        node = self.front_node
        while node != None:
            if node.key == key:
                if node == self.front_node:
                    self.front_node = self.front_node.next_node
                if node == self.last_node:
                    self.last_node = self.last_node.prev_node
                if node.prev_node != None:
                    node.prev_node.next_node = node.next_node
                if node.next_node != None:
                    node.next_node.prev_node = node.prev_node
                self.size -= 1
                break
            node = node.next_node

    def delete_first(self):
        if self.size == 0:
            return
        elif self.size == 1:
            self.front_node = None
            self.last_node = None
            self.size -= 1
        else:
            self.front_node = self.front_node.next_node
            self.front_node.prev_node = None
            self.size -= 1

    def delete_last(self):
        if self.size == 0:
            return
        elif self.size == 1:
            self.front_node = None
            self.last_node = None
            self.size -= 1
        else:
            self.last_node = self.last_node.prev_node
            self.last_node.next_node = None
            self.size -= 1

    def to_a(self):
        a = []
        node = self.front_node
        while node != None:
            a.append(node.key)
            node = node.next_node
        return a

l = LinkedList()
n = int(input())
lines = sys.stdin.readlines()
for i in range(n):
    ins = lines[i].split()
    command = ins[0]
    if command == "insert":
        x = int(ins[1])
        l.insert(x)
    elif command == "delete":
        x = int(ins[1])
        l.delete(x)
    elif command == "deleteFirst":
        l.delete_first()
    elif command == "deleteLast":
        l.delete_last()

print(" ".join(map(str, l.to_a())))

Fixed submission:
import sys
from collections import deque

d = deque()
n = int(input())
lines = sys.stdin.readlines()
for i in range(n):
    ins = lines[i].split()
    command = ins[0]
    if command == "insert":
        d.appendleft(ins[1])
    elif command == "delete":
        try:
            d.remove(ins[1])
        except:
            pass
    elif command == "deleteFirst":
        d.popleft()
    elif command == "deleteLast":
        d.pop()

print(" ".join(d))

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

d = deque()
n = int(input())
lines = sys.stdin.readlines()
for i in range(n):
    ins = lines[i].split()
    command = ins[0]
    if command == "insert":
        d.appendleft(ins[1])
    elif command == "delete":
        d.remove(ins[1])
    elif command == "deleteFirst":
        d.popleft()
    elif command == "deleteLast":
        d.pop()

print(" ".join(d))

Fixed submission:
import sys
from collections import deque

d = deque()
n = int(input())
lines = sys.stdin.readlines()
for i in range(n):
    ins = lines[i].split()
    command = ins[0]
    if command == "insert":
        d.appendleft(ins[1])
    elif command == "delete":
        try:
            d.remove(ins[1])
        except:
            pass
    elif command == "deleteFirst":
        d.popleft()
    elif command == "deleteLast":
        d.pop()

print(" ".join(d))