Buggy python submission (verdict: Time Limit Exceeded):
class DLList:
    class Cell:
        def __init__(self, data, pre, nex):
            self.data = data
            self.pre = pre
            self.nex = nex
    
    def __init__(self):
        self.top = DLList.Cell(None, None, None)

    def insert(self, x):
        if self.top.nex == None:
            w = DLList.Cell(x, self.top, self.top)
            self.top.nex = w
            self.top.pre = w
        else:
            w = DLList.Cell(x, self.top, self.top.nex)
            self.top.nex.pre = w
            self.top.nex = w
            
    def delete(self, x):
        w = self.top.nex
        while w != self.top:
            if w.data == x:
                w.pre.nex = w.nex
                w.nex.pre = w.pre
                break
            w = w.nex
            
    def deleteFirst(self):
        w = self.top.nex
        w.pre.nex = w.nex
        w.nex.pre = w.pre
     
    def deleteLast(self):
        w = self.top.pre
        w.pre.nex = w.nex
        w.nex.pre = w.pre 
           
    def pri(self):
        w = self.top.nex
        while w != self.top:
            if w.nex == self.top:
                print(w.data)
                break
            else:
                print(w.data,end=" ")
            w = w.nex

a = DLList()
n = int(input())
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.insert(int(s[1]))
    elif s[0] == "delete":
        a.delete(int(s[1]))
    elif s[0] == "deleteLast":
        a.deleteLast()
    elif s[0] == "deleteFirst":
        a.deleteFirst()
a.pri()

Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.appendleft(int(s[1]))
    elif s[0] == "delete":
        if int(s[1]) in a:
            a.remove(int(s[1]))
    elif s[0] == "deleteLast":
        a.pop()
    elif s[0] == "deleteFirst":
        a.popleft()
b = list(a)
for i in range(len(b)):
    if i == len(b)-1:
        print(b[i])
    else:
        print(b[i],end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
class DLList:
    class Cell:
        def __init__(self, data, pre, nex):
            self.data = data
            self.pre = pre
            self.nex = nex
    
    def __init__(self):
        self.top = DLList.Cell(None,None,None)
        self.top.nex = self.top

    def insert(self, x):
        w = DLList.Cell(x, self.top, self.top.nex)
        self.top.nex.pre = w
        self.top.nex = w
            
    def delete(self, x):
        w = self.top.nex
        while w != self.top:
            if w.data == x:
                w.pre.nex = w.nex
                w.nex.pre = w.pre
                break
            w = w.nex
            
    def deleteFirst(self):
        w = self.top.nex
        w.pre.nex = w.nex
        w.nex.pre = w.pre
     
    def deleteLast(self):
        w = self.top.pre
        w.pre.nex = w.nex
        w.nex.pre = w.pre 
           
    def pri(self):
        w = self.top.nex
        while w != self.top:
            if w.nex == self.top:
                print(w.data)
                break
            else:
                print(w.data,end=" ")
            w = w.nex

a = DLList()
n = int(input())
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.insert(int(s[1]))
    elif s[0] == "delete":
        a.delete(int(s[1]))
    elif s[0] == "deleteLast":
        a.deleteLast()
    elif s[0] == "deleteFirst":
        a.deleteFirst()
a.pri()

Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.appendleft(int(s[1]))
    elif s[0] == "delete":
        if int(s[1]) in a:
            a.remove(int(s[1]))
    elif s[0] == "deleteLast":
        a.pop()
    elif s[0] == "deleteFirst":
        a.popleft()
b = list(a)
for i in range(len(b)):
    if i == len(b)-1:
        print(b[i])
    else:
        print(b[i],end=" ")

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.appendleft(int(s[1]))
    elif s[0] == "delete":
        a.remove(int(s[1]))
    elif s[0] == "deleteLast":
        a.pop()
    elif s[0] == "deleteFirst":
        a.popleft()
b = list(a)
for i in range(len(b)):
    if i == len(b)-1:
        print(b[i])
    else:
        print(b[i],end=" ")

Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.appendleft(int(s[1]))
    elif s[0] == "delete":
        if int(s[1]) in a:
            a.remove(int(s[1]))
    elif s[0] == "deleteLast":
        a.pop()
    elif s[0] == "deleteFirst":
        a.popleft()
b = list(a)
for i in range(len(b)):
    if i == len(b)-1:
        print(b[i])
    else:
        print(b[i],end=" ")