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

def insert(x, dll):
    dll.appendleft(x)

def delete(x, dll):
    dll.remove(x)

def deleteFirst(dll):
    dll.popleft()

def deleteLast(dll):
    dll.pop()

n = int(input())
command1 = {"insert": insert, "delete": delete}
command2 = {"deleteFirst": deleteFirst, "deleteLast": deleteLast}
dll = deque()
for i in range(n):
    input_line = [str(s) for s in input().split()]
    if(input_line[0] in command1):
        command1[input_line[0]](int(input_line[1]), dll)
    else:
        command2[input_line[0]](dll)
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def insert(x, dll):
    dll.appendleft(x)

def delete(x, dll):
    try:
        dll.remove(x)
    except ValueError:
        pass

def deleteFirst(dll):
    dll.popleft()

def deleteLast(dll):
    dll.pop()

n = int(input())
command1 = {"insert": insert, "delete": delete}
command2 = {"deleteFirst": deleteFirst, "deleteLast": deleteLast}
dll = deque()
for i in range(n):
    input_line = [str(s) for s in input().split()]
    if(input_line[0] in command1):
        command1[input_line[0]](int(input_line[1]), dll)
    else:
        command2[input_line[0]](dll)
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

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

f = open("input.txt")
n = int(f.readline())
dll = deque()

for i in range(n):
    input_line = [str(s) for s in f.readline().split()]
    if input_line[0] == "insert":
        dll.appendleft(int(input_line[1]))
    elif input_line[0] == "delete":
        try:
            dll.remove(int(input_line[1]))
        except ValueError:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
dll = deque()

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

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
dll = deque()

for i in range(n):
    input_line = [str(s) for s in input().split()]
    if input_line[0] == "insert":
        dll.appendleft(int(input_line[1]))
    elif input_line[0] == "delete":
        dll.remove(int(input_line[1]))
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
dll = deque()

for i in range(n):
    input_line = [str(s) for s in input().split()]
    if input_line[0][0] == "i":
        dll.appendleft(int(input_line[1]))
    elif input_line[0] == "delete":
        try:
            dll.remove(int(input_line[1]))
        except:
            pass
    elif input_line[0][6] == "F":
        dll.popleft()
    else:
        dll.pop()
        
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
dll = deque()

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

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
 
n = int(input())
dll = deque()
 
for i in range(n):
    input_line = [str(s) for s in input().split()]
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif len(dll) == 0:
        continue
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
         
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
  
n = int(input())
dll = deque()
  
for i in range(n):
    input_line = [str(s) for s in input().split()]
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
          
print(*dll)

Fixed submission:
from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)