Buggy python submission (verdict: Runtime Error):
l = []
n = int(input())
for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.insert(0,int(cmd[1]))
    if cmd[0]=='delete':
        l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.pop(0)
    if cmd[0]=='deleteLast':
        l.pop(len(l)-1)
print(*l)


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

Buggy python submission (verdict: Runtime Error):
l = []
n = int(input())
for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.insert(0,int(cmd[1]))
    if cmd[0]=='delete':
        l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.pop(0)
    if cmd[0]=='deleteLast':
        l.pop(len(l)-1)
print(*l)


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

Buggy python submission (verdict: Time Limit Exceeded):
l = []
n = int(input())
for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.insert(0,int(cmd[1]))
    if cmd[0]=='delete':
        if int(cmd[1]) in l:
            l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.pop(0)
    if cmd[0]=='deleteLast':
        l.pop(len(l)-1)
print(*l)


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

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
l = deque()
count = set([])
for _ in range (n):
    cmd = input().split(' ')
    print(cmd)
    if cmd[0]=='insert':
        l.appendleft(int(cmd[1]))
        if not int(cmd[1]) in count:
            count.add(int(cmd[1]))
    if cmd[0]=='delete':
        if len(l) !=0 and int(cmd[2]) in count:
            l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.popleft()
    if cmd[0]=='deleteLast':
        l.pop()
    print(*l)


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

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
l = deque()
count = set([])
for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.appendleft(int(cmd[1]))
        if not int(cmd[1]) in count:
            count.add(int(cmd[1]))
    if cmd[0]=='delete':
        if len(l) !=0 and int(cmd[2]) in count:
            l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.popleft()
    if cmd[0]=='deleteLast':
        l.pop()
print(*l)


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

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
l = deque()
count = set([])
for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.appendleft(int(cmd[1]))
        if not int(cmd[1]) in count:
            count.add(int(cmd[1]))
    if cmd[0]=='delete':
        if len(l) !=0 and int(cmd[1]) in count:
            l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.popleft()
    if cmd[0]=='deleteLast':
        l.pop()
print(*l)


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

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
l = deque()
count = set([])
for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.appendleft(int(cmd[1]))
        if not int(cmd[1]) in count:
            count.add(int(cmd[1]))
    if cmd[0]=='delete':
        if len(l) !=0 and int(cmd[1]) in count:
            l.remove(int(cmd[1]))
            count.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        count.remove(l.popleft())
    if cmd[0]=='deleteLast':
        count.remove(l.pop())
print(*l)


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

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
l = deque()

for _ in range (n):
    cmd = input().split(' ')
    if cmd[0]=='insert':
        l.appendleft(int(cmd[1]))
    if cmd[0]=='delete':
       if len(l) !=0 and int(cmd[1]) in l:
            l.remove(int(cmd[1]))
    if cmd[0]=='deleteFirst':
        l.popleft()
    if cmd[0]=='deleteLast':
        l.pop()
print(*l)


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

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
l = deque()
count ={}
for _ in range (n):
    cmd = input().split(' ')
    
    if cmd[0]=='insert':
        val = int(cmd[1])
        l.appendleft(val)
        if val not in count :
            count[val] =1
        else :
            count[val] +=1
                
    if cmd[0]=='delete':
        val = int(cmd[1])
        if len(l) !=0 and val in count:
           if count[val]:
            l.remove(val)
            count[val] -=1 
    
    if cmd[0]=='deleteFirst':
        val = l.popleft()
        count[val] -=1
    if cmd[0]=='deleteLast':
        val =l.pop()
        count[val] -=1
print(*l)


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

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
l = deque()

for _ in range (n):
    cmd = input().split(' ')
    
    if cmd[0]=='insert':
        val = int(cmd[1])
        l.appendleft(val)
                
    if cmd[0]=='delete':
        val = int(cmd[1])
        try:l.remove(val)
        except :pass
    
    if cmd[0]=='deleteFirst':
        l.popleft()
       
    if cmd[0]=='deleteLast':
        l.pop()
print(*l)



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