Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
d = deque()
for _ in range(n):
    x = input().split()
    if x[0][0] == 'i':
        d.appendleft(int(x[1]))
    elif x[0] == 'delete':
        try:
            d.remove(int(x[1]))
        except ValueError:
            pass
    elif x[0][6] == 'F':
        d.popleft()
    else:
        d.pop()
print(*d)


Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
d = deque()
for _ in range(n):
    x = input().split()
    if x[0][0] == 'i':
        d.appendleft(int(x[1]))
    elif x[0] == 'delete':
        try:
            d.remove(int(x[1]))
        except ValueError:
            pass
    elif x[0][6] == 'F':
        d.popleft()
    else:
        d.pop()
print(*d)


Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if s[0] == 'insert': d.appendleft(int(s[1])
    elif s[0] =='delete': 
        if s[1] in d:
            d.remove(s[1])
        else: pass
    elif s[0] =='deleteFirst': d.popleft()
    else: d.pop()

  print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if s[0] == 'insert': d.appendleft(int(s[1])
    elif s[0] =='delete': 
        if s[1] in d:
            d.remove(s[1])
        else: pass
    elif s[0] =='deleteFirst': d.popleft()
    else: d.pop()

  print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

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

print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

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

print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    elif str(s[0]) =='delete': 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
    elif str(s[0][6]) =='F': d.popleft()
    else: d.pop()

print(*d)




Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
    
    

print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
    
    

print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)

Buggy python submission (verdict: Runtime Error):
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
print(*d)



Fixed submission:
import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)