Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
output = []
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.insert(0, int(li[1]))
    elif(li[0] == 'delete'):
        if(int(li[1]) in output):
            output.remove(int(li[1]))
    elif(li[0] == 'deleteFirst'):
        del output[0]
    elif(li[0] == 'deleteLast'):
        del output[-1]
str_l = [str(o) for o in output]
print(' '.join(str_l))



Fixed submission:
from collections import deque
n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(li[1])
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
    elif(li[0] == 'delete'):
        try:
            output.remove(li[1])
        except:
            pass
print(' '.join(output))

Buggy python submission (verdict: Runtime Error):
n = int(input())
output = []
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.insert(0, int(li[1]))
    elif(li[0] == 'delete'):
        output.remove(int(li[1]))
    elif(li[0] == 'deleteFirst'):
        del output[0]
    elif(li[0] == 'deleteLast'):
        del output[-1]
str_l = [str(o) for o in output]
print(' '.join(str_l))



Fixed submission:
from collections import deque
n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(li[1])
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
    elif(li[0] == 'delete'):
        try:
            output.remove(li[1])
        except:
            pass
print(' '.join(output))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
output = []
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.insert(0, int(li[1]))
    elif(li[0] == 'delete'):
        if(int(li[1]) in output):
            output.remove(int(li[1]))
    elif(li[0] == 'deleteFirst'):
        del output[0]
    elif(li[0] == 'deleteLast'):
        del output[-1]
str_l = [str(o) for o in output]
print(' '.join(str_l))



Fixed submission:
from collections import deque
n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(li[1])
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
    elif(li[0] == 'delete'):
        try:
            output.remove(li[1])
        except:
            pass
print(' '.join(output))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
output = []
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output[0:0] = [int(li[1])]
        #output.insert(0, int(li[1]))
    elif(li[0] == 'delete'):
        if(int(li[1]) in output):
            output.remove(int(li[1]))
    elif(li[0] == 'deleteFirst'):
        del output[0]
    elif(li[0] == 'deleteLast'):
        del output[-1]
str_l = [str(o) for o in output]
print(' '.join(str_l))



Fixed submission:
from collections import deque
n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(li[1])
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
    elif(li[0] == 'delete'):
        try:
            output.remove(li[1])
        except:
            pass
print(' '.join(output))

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

n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(int(li[1]))
    elif(li[0] == 'delete'):
        if(int(li[1]) in output):
            output.remove(int(li[1]))
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
str_l = [str(o) for o in output]
print(' '.join(str_l))



Fixed submission:
from collections import deque
n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(li[1])
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
    elif(li[0] == 'delete'):
        try:
            output.remove(li[1])
        except:
            pass
print(' '.join(output))

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

n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(int(li[1]))
    elif(li[0] == 'delete'):
        try:
            output.remove(int(li[1]))
        except:
            pass
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
str_l = [str(o) for o in output]
print(' '.join(str_l))



Fixed submission:
from collections import deque
n = int(input())
output = deque()
for i in range(n):
    li = input().split(' ')
    if(li[0] == 'insert'):
        output.appendleft(li[1])
    elif(li[0] == 'deleteFirst'):
        output.popleft()
    elif(li[0] == 'deleteLast'):
        output.pop()
    elif(li[0] == 'delete'):
        try:
            output.remove(li[1])
        except:
            pass
print(' '.join(output))