Buggy python submission (verdict: Time Limit Exceeded):
class Node():
    def __init__(self,value,front_node,back_node):
        self.value = value
        self.front_node = front_node
        self.back_node = back_node

def insert(value,first_node):
    if first_node == None:
        new_node = Node(value, None, None)
    else:
        new_node = Node(value, None, first_node)
        first_node.front_node = new_node
    first_node = new_node
    return first_node

def delete(chk,first_node):
    flag = True
    next_node = first_node
    while flag:
        if next_node.value == chk:
            flag = False
            if next_node.back_node == None:
                deleteLast(first_node)
            elif next_node.front_node == None:
                first_node = deleteFirst(first_node)
            else:
                next_node.front_node.back_node = next_node.back_node
                next_node.back_node.front_node = next_node.front_node
                next_node = None
        else:
            if next_node.back_node == None:
                flag = False
            else:
                next_node = next_node.back_node
    return first_node


def deleteFirst(first_node):
    if first_node.back_node == None:
        first_node = None
    else:
        first_node.back_node.front_node = None
        first_node = first_node.back_node
    return first_node

def deleteLast(first_node):
    flag = True
    check_node = first_node
    while flag:
        if check_node.back_node == None:
            if check_node.front_node == None:
                first_node = None
            else:
                check_node.front_node.back_node = None
                check_node = None
            flag = False
                #first_nodeをNoneにする
        else:
            check_node = check_node.back_node
    return first_node






n = int(input())
first_node = None
for i in range(n):
    tmp = input().split(" ")
    if tmp[0] == "insert":
        first_node = insert(int(tmp[1]),first_node)
    elif tmp[0] == "delete":
        first_node = delete(int(tmp[1]),first_node)
    elif tmp[0] == "deleteFirst":
        first_node = deleteFirst(first_node)
    elif tmp[0] == "deleteLast":
        first_node = deleteLast(first_node)

chk_node = first_node
answer = []
final_flag = True
while final_flag:
    if chk_node.back_node == None:
        final_flag = False
    answer.append(chk_node.value)
    chk_node = chk_node.back_node


print(' '.join(map(str,answer)))



Fixed submission:
class D_Linked_List:
    class Node:
        def __init__(self, key, next = None, prev = None):
            self.next = next
            self.prev = prev
            self.key = key
 
    def __init__(self):
        self.nil = D_Linked_List.Node(None)
        self.nil.next = self.nil
        self.nil.prev = self.nil
 
    def insert(self, key):
        node_x = D_Linked_List.Node(key, self.nil.next, self.nil)
        self.nil.next.prev = node_x
        self.nil.next = node_x
 
    def _listSearch(self, key):
        cur_node = self.nil.next
        while (cur_node != self.nil) and (cur_node.key != key):
            cur_node = cur_node.next
        return cur_node
 
    def _deleteNode(self, node):
        if node == self.nil:
            return None
        node.prev.next = node.next
        node.next.prev = node.prev
 
    def deleteFirst(self):
        self._deleteNode(self.nil.next)
 
    def deleteLast(self):
        self._deleteNode(self.nil.prev)
 
    def deleteKey(self, key):
        node = self._listSearch(key)
        self._deleteNode(node)
 
    def show_keys(self):
        cur_node = self.nil.next
        keys = []
        while cur_node != self.nil:
            keys.append(cur_node.key)
            cur_node = cur_node.next
        print(' '.join(keys))
 
 
import sys
 
d_ll = D_Linked_List()
 
for i in sys.stdin:
    if 'insert' in i:
        x = i[7:-1]
        d_ll.insert(x)
    elif 'deleteFirst' in i:
        d_ll.deleteFirst()
    elif 'deleteLast' in i:
        d_ll.deleteLast()
    elif 'delete' in i:
        x = i[7:-1]
        d_ll.deleteKey(x)
    else:
        pass
 
d_ll.show_keys()

Buggy python submission (verdict: Runtime Error):
class Node():
    def __init__(self,value,prv,nxt):
        self.value = value
        self.prv = prv
        self.nxt = nxt

class LinkedList():

    def __init__(self,head,tail):
        self.head = head
        self.tail = tail

    def insert(self,value):
        if self.head == None:
            self.head = Node(value,None,None)
            self.tail = self.head
        else:
            node = Node(value,None,self.head)
            if self.head.nxt == self.tail: #when only one node exists.
                self.head.prv = node
                self.head = node
            else:
                self.head.prv = node
                self.head = node

    def delete(self,value):
        check_node = self.head
        while True:
            if check_node.value == value:
                if check_node.nxt == None:
                    self.deleteLast()
                else:
                    check_node.prv.nxt = check_node.nxt
                    check_node.nxt.prv = check_node.prv
                break
            else:
                check_node = check_node.nxt

    def deleteFirst(self):
        if self.head.nex == None:
            self.head == None
        else:
            self.head = self.head.nxt

    def deleteLast(self):
        self.tail.prv.nxt = None
        self.tail = self.tail.prv

n = int(input())
linkedList = LinkedList(None,None)

def getAnswer(linkedList):
    answer = []
    check = linkedList.head
    while True:
        answer.append(check.value)
        if check.nxt == None:
            break
        else:
            check = check.nxt

    print(" ".join(map(str,answer)))

for _ in range(n):
    line = input()
    if not (line == "deleteFirst" and line == "deleteLast"):
        command = line.split(" ")[0]
        value = int(line.split(" ")[1])
    else:
        command = line

    if command == "insert":
        linkedList.insert(value)
    elif command == "delete":
        linkedList.delete(value)
    elif command == "deleteFirst":
        linkedList.deleteFirst()
    elif command == "deleteLast":
        linkedList.deleteLast()

getAnswer(linkedList)



Fixed submission:
class D_Linked_List:
    class Node:
        def __init__(self, key, next = None, prev = None):
            self.next = next
            self.prev = prev
            self.key = key
 
    def __init__(self):
        self.nil = D_Linked_List.Node(None)
        self.nil.next = self.nil
        self.nil.prev = self.nil
 
    def insert(self, key):
        node_x = D_Linked_List.Node(key, self.nil.next, self.nil)
        self.nil.next.prev = node_x
        self.nil.next = node_x
 
    def _listSearch(self, key):
        cur_node = self.nil.next
        while (cur_node != self.nil) and (cur_node.key != key):
            cur_node = cur_node.next
        return cur_node
 
    def _deleteNode(self, node):
        if node == self.nil:
            return None
        node.prev.next = node.next
        node.next.prev = node.prev
 
    def deleteFirst(self):
        self._deleteNode(self.nil.next)
 
    def deleteLast(self):
        self._deleteNode(self.nil.prev)
 
    def deleteKey(self, key):
        node = self._listSearch(key)
        self._deleteNode(node)
 
    def show_keys(self):
        cur_node = self.nil.next
        keys = []
        while cur_node != self.nil:
            keys.append(cur_node.key)
            cur_node = cur_node.next
        print(' '.join(keys))
 
 
import sys
 
d_ll = D_Linked_List()
 
for i in sys.stdin:
    if 'insert' in i:
        x = i[7:-1]
        d_ll.insert(x)
    elif 'deleteFirst' in i:
        d_ll.deleteFirst()
    elif 'deleteLast' in i:
        d_ll.deleteLast()
    elif 'delete' in i:
        x = i[7:-1]
        d_ll.deleteKey(x)
    else:
        pass
 
d_ll.show_keys()

Buggy python submission (verdict: Runtime Error):
class Node():
    def __init__(self,value,prv,nxt):
        self.value = value
        self.prv = prv
        self.nxt = nxt

class LinkedList():

    def __init__(self,head,tail):
        self.head = head
        self.tail = tail

    def insert(self,value):
        if self.head == None:
            self.head = Node(value,None,None)
            self.tail = self.head
        else:
            node = Node(value,None,self.head)
            if self.head.nxt == self.tail: #when only one node exists.
                self.head.prv = node
                self.head = node
            else:
                self.head.prv = node
                self.head = node

    def delete(self,value):
        check_node = self.head
        while True:
            if check_node.value == value:
                if check_node == self.tail:
                    self.deleteLast()
                elif check_node == self.head:
                    self.head = check_node.nxt
                    check_node.nxt.prv = None
                else:
                    check_node.prv.nxt = check_node.nxt
                    check_node.nxt.prv = check_node.prv
                break
            else:
                check_node = check_node.nxt

    def deleteFirst(self):
        if self.head.nxt == None:
            self.head == None
        else:
            self.head = self.head.nxt

    def deleteLast(self):
        self.tail.prv.nxt = None
        self.tail = self.tail.prv

n = int(input())
linkedList = LinkedList(None,None)

def getAnswer(linkedList):
    answer = []
    check = linkedList.head
    while True:
        answer.append(check.value)
        if check.nxt == None:
            break
        else:
            check = check.nxt

    print(" ".join(map(str,answer)))

for _ in range(n):
    line = input()
    #print(line)
    if not line == "deleteFirst" and not line == "deleteLast":
        command = line.split(" ")[0]
        value = int(line.split(" ")[1])
    else:
        command = line

    if command == "insert":
        linkedList.insert(value)
    elif command == "delete":
        linkedList.delete(value)
    elif command == "deleteFirst":
        linkedList.deleteFirst()
    elif command == "deleteLast":
        linkedList.deleteLast()

    #getAnswer(linkedList)

getAnswer(linkedList)



Fixed submission:
class D_Linked_List:
    class Node:
        def __init__(self, key, next = None, prev = None):
            self.next = next
            self.prev = prev
            self.key = key
 
    def __init__(self):
        self.nil = D_Linked_List.Node(None)
        self.nil.next = self.nil
        self.nil.prev = self.nil
 
    def insert(self, key):
        node_x = D_Linked_List.Node(key, self.nil.next, self.nil)
        self.nil.next.prev = node_x
        self.nil.next = node_x
 
    def _listSearch(self, key):
        cur_node = self.nil.next
        while (cur_node != self.nil) and (cur_node.key != key):
            cur_node = cur_node.next
        return cur_node
 
    def _deleteNode(self, node):
        if node == self.nil:
            return None
        node.prev.next = node.next
        node.next.prev = node.prev
 
    def deleteFirst(self):
        self._deleteNode(self.nil.next)
 
    def deleteLast(self):
        self._deleteNode(self.nil.prev)
 
    def deleteKey(self, key):
        node = self._listSearch(key)
        self._deleteNode(node)
 
    def show_keys(self):
        cur_node = self.nil.next
        keys = []
        while cur_node != self.nil:
            keys.append(cur_node.key)
            cur_node = cur_node.next
        print(' '.join(keys))
 
 
import sys
 
d_ll = D_Linked_List()
 
for i in sys.stdin:
    if 'insert' in i:
        x = i[7:-1]
        d_ll.insert(x)
    elif 'deleteFirst' in i:
        d_ll.deleteFirst()
    elif 'deleteLast' in i:
        d_ll.deleteLast()
    elif 'delete' in i:
        x = i[7:-1]
        d_ll.deleteKey(x)
    else:
        pass
 
d_ll.show_keys()

Buggy python submission (verdict: Time Limit Exceeded):
class Node():
    def __init__(self,value,prv,nxt):
        self.value = value
        self.prv = prv
        self.nxt = nxt

class LinkedList():

    def __init__(self,head,tail):
        self.head = head
        self.tail = tail

    def insert(self,value):
        if self.head == None:
            self.head = Node(value,None,None)
            self.tail = self.head
        else:
            node = Node(value,None,self.head)
            if self.head.nxt == self.tail: #when only one node exists.
                self.head.prv = node
                self.head = node
            else:
                self.head.prv = node
                self.head = node

    def delete(self,value):
        check_node = self.head
        while not check_node == None:
            if check_node.value == value:
                if check_node == self.tail:
                    self.deleteLast()
                elif check_node == self.head:
                    self.head = check_node.nxt
                    check_node.nxt.prv = None
                else:
                    check_node.prv.nxt = check_node.nxt
                    check_node.nxt.prv = check_node.prv
                break
            check_node = check_node.nxt

    def deleteFirst(self):
        if self.head.nxt == None:
            self.head == None
        else:
            self.head = self.head.nxt

    def deleteLast(self):
        if self.head == self.tail:
            self.head = None
            self.tail = None
        else:
            self.tail.prv.nxt = None
            self.tail = self.tail.prv

n = int(input())
linkedList = LinkedList(None,None)

def getAnswer(linkedList):
    answer = []
    check = linkedList.head
    while True:
        answer.append(check.value)
        if check.nxt == None:
            break
        else:
            check = check.nxt

    print(" ".join(map(str,answer)))

for _ in range(n):
    line = input()
    #print(line)
    if not line == "deleteFirst" and not line == "deleteLast":
        command = line.split(" ")[0]
        value = int(line.split(" ")[1])
    else:
        command = line

    if command == "insert":
        linkedList.insert(value)
    elif command == "delete":
        linkedList.delete(value)
    elif command == "deleteFirst":
        linkedList.deleteFirst()
    elif command == "deleteLast":
        linkedList.deleteLast()

    #getAnswer(linkedList)

getAnswer(linkedList)



Fixed submission:
class D_Linked_List:
    class Node:
        def __init__(self, key, next = None, prev = None):
            self.next = next
            self.prev = prev
            self.key = key
 
    def __init__(self):
        self.nil = D_Linked_List.Node(None)
        self.nil.next = self.nil
        self.nil.prev = self.nil
 
    def insert(self, key):
        node_x = D_Linked_List.Node(key, self.nil.next, self.nil)
        self.nil.next.prev = node_x
        self.nil.next = node_x
 
    def _listSearch(self, key):
        cur_node = self.nil.next
        while (cur_node != self.nil) and (cur_node.key != key):
            cur_node = cur_node.next
        return cur_node
 
    def _deleteNode(self, node):
        if node == self.nil:
            return None
        node.prev.next = node.next
        node.next.prev = node.prev
 
    def deleteFirst(self):
        self._deleteNode(self.nil.next)
 
    def deleteLast(self):
        self._deleteNode(self.nil.prev)
 
    def deleteKey(self, key):
        node = self._listSearch(key)
        self._deleteNode(node)
 
    def show_keys(self):
        cur_node = self.nil.next
        keys = []
        while cur_node != self.nil:
            keys.append(cur_node.key)
            cur_node = cur_node.next
        print(' '.join(keys))
 
 
import sys
 
d_ll = D_Linked_List()
 
for i in sys.stdin:
    if 'insert' in i:
        x = i[7:-1]
        d_ll.insert(x)
    elif 'deleteFirst' in i:
        d_ll.deleteFirst()
    elif 'deleteLast' in i:
        d_ll.deleteLast()
    elif 'delete' in i:
        x = i[7:-1]
        d_ll.deleteKey(x)
    else:
        pass
 
d_ll.show_keys()