Buggy python submission (verdict: Time Limit Exceeded):
def delete(l, num):
    for i, x in enumerate(l):
        if x == num:
            return l[0:i] + l[i+1:]
    return l


n = int(input())
l = []
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        l = [int(com[1])] + l
    elif com[0] == 'delete':
        l = delete(l, int(com[1]))
    elif com[0] == 'deleteFirst':
        l = l[1:]
    elif com[0] == 'deleteLast':
        l = l[:-1]
print(*l)

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=1000000)

n = int(input())
for i in range(n):
    com = input().split()
    if com[0]=='insert':
        q.appendleft(int(com[1]))
    elif com[0]=='delete':
        try:
            q.remove(int(com[0]))
        except ValueError:
            pass
    elif com[0]=='deleteFirst':
        q.popleft()
    elif com[0]=='deleteLast':
        q.pop()
print(' '.join(q))

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=1000000)

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

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=1000000)

n = int(input())
for i in range(n):
    com = input().split()
    if com[0]=='insert':
        q.appendleft(int(com[1]))
    elif com[0]=='delete':
        try:
            q.remove(int(com[0]))
        except ValueError:
            pass
    elif com[0]=='deleteFirst':
        q.popleft()
    elif com[0]=='deleteLast':
        q.pop()
print(' '.join(q))

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=1000000)

n = int(input())
for i in range(n):
    com = input().split()
    if com[0]=='insert':
        q.appendleft(int(com[1]))
    elif com[0]=='delete':
        try:
            q.remove(int(com[1]))
        except ValueError:
            pass
    elif com[0]=='deleteFirst':
        q.popleft()
    elif com[0]=='deleteLast':
        q.pop()
print(' '.join(q))

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=1000000)

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

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=1000000)

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

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque(maxlen=10000)

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

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

Buggy python submission (verdict: Time Limit Exceeded):
def delete(l, num):
    for i, x in enumerate(l):
        if x == num:
            return l[0:i] + l[i+1:]
    return l


n = int(input())
l = []
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        l = [int(com[1])] + l
    elif com[0] == 'delete':
        l = delete(l, int(com[1]))
    elif com[0] == 'deleteFirst':
        l = l[1:]
    elif com[0] == 'deleteLast':
        l = l[:-1]
print(*l)

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque()

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

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

Buggy python submission (verdict: Runtime Error):
import collections
q = collections.deque()

n = int(input())
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        q.appendleft(int(com[1]))
    elif com[0] == 'delete':
        q.remove(int(com[1]))
    elif com[0] == 'deleteFirst':
        q.popleft()
    elif com[0] == 'deleteLast':
        q.pop()
print(' '.join(q))

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

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

print(' '.join(q))

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