Buggy python submission (verdict: Runtime Error):
from collections import deque
q = deque()
for _ in range(int(input())):
    c, *k = input().split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)


Fixed submission:
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
    if s == '\n':
        break
    c, *k = s.split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        if k in q:
            q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
q = deque()
for _ in range(int(input())):
    c, *k = input().split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        if k in q:
            q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)


Fixed submission:
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
    if s == '\n':
        break
    c, *k = s.split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        if k in q:
            q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)

Buggy python submission (verdict: Runtime Error):
from collections import deque
q = deque()
for _ in range(int(input())):
    c, *k = input().split()
    k = k[0] if k else None
    if c[0] == 'i':
        q.appendleft(k)
    elif c[0] == 'd':
        if c[6] == 'F':
            q.popleft()
        elif c[6] == 'L':
            q.pop()
        else:
            if k in q:
                q.remove(k)
print(*q)


Fixed submission:
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
    if s == '\n':
        break
    c, *k = s.split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        if k in q:
            q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
q = deque()
for _ in range(int(input())):
    c, *k = input().split()
    k = k[0] if k else None
    if c[0] == 'i':
        q.appendleft(k)
    elif c[0] == 'd':
        if c[6:7] == 'F':
            q.popleft()
        elif c[6:7] == 'L':
            q.pop()
        else:
            if k in q:
                q.remove(k)
print(*q)


Fixed submission:
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
    if s == '\n':
        break
    c, *k = s.split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        if k in q:
            q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)

Buggy python submission (verdict: Runtime Error):
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
    c, *k = s.split()
    k = k[0] if k else None
    if c[0] == 'i':
        q.appendleft(k)
    elif c[0] == 'delete':
        if k in q:
            q.remove(k)
    if c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)


Fixed submission:
from collections import deque
from sys import stdin
q = deque()
input()
for s in stdin:
    if s == '\n':
        break
    c, *k = s.split()
    k = k[0] if k else None
    if c == 'insert':
        q.appendleft(k)
    elif c == 'delete':
        if k in q:
            q.remove(k)
    elif c == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(*q)