Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
n = int(stdin.readline())
dll = []
while n:
    n -= 1
    cmd = stdin.readline().rstrip()
    if cmd.startswith('insert '):
        dll.insert(0, cmd[7:])
    elif cmd.startswith('delete '):
        dll.remove(cmd[7:])
    elif cmd.startswith('deleteFirst'):
        del dll[0]
    elif cmd.startswith('deleteLast'):
        del dll[-1]
print(*dll)

Fixed submission:
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
from collections import deque

n = int(stdin.readline())
dll = deque()
fcode = ord('F')
lcode = ord('L')
while n:
    n -= 1
    cmd = stdin.readline().rstrip()
    if cmd.startswith('i'):
        dll.appendleft(int(cmd[7:]))
    elif cmd.startswith('d'):
        c = ord(cmd[6])
        if c == fcode:
            dll.popleft()
        elif c == lcode:
            dll.pop()
        else:
            try:
                dll.remove(int(cmd[7:]))
            except ValueError:
                pass
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
n = int(stdin.readline())
dll = []
while n:
    n -= 1
    cmd = stdin.readline().rstrip()
    if cmd.startswith('insert '):
        dll.insert(0, cmd[7:])
    elif cmd.startswith('delete '):
        key = cmd[7:]
        if dll.count(key):
            dll.remove(key)
    elif cmd.startswith('deleteFirst'):
        del dll[0]
    elif cmd.startswith('deleteLast'):
        del dll[-1]
print(*dll)

Fixed submission:
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
from collections import deque

n = int(stdin.readline())
dll = deque()
fcode = ord('F')
lcode = ord('L')
while n:
    n -= 1
    cmd = stdin.readline().rstrip()
    if cmd.startswith('i'):
        dll.appendleft(int(cmd[7:]))
    elif cmd.startswith('d'):
        c = ord(cmd[6])
        if c == fcode:
            dll.popleft()
        elif c == lcode:
            dll.pop()
        else:
            try:
                dll.remove(int(cmd[7:]))
            except ValueError:
                pass
print(*dll)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
from array import array
n = int(stdin.readline())
dll = array('i')
while n:
    n -= 1
    cmd = stdin.readline()
    if cmd.startswith('insert '):
        dll.insert(0, int(cmd[7:]))
    elif cmd.startswith('deleteFirst'):
        del dll[0]
    elif cmd.startswith('deleteLast'):
        del dll[-1]
    elif cmd.startswith('delete '):
        key = int(cmd[7:])
        if dll.count(key):
            dll.remove(key)
print(*dll)

Fixed submission:
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
from collections import deque

n = int(stdin.readline())
dll = deque()
fcode = ord('F')
lcode = ord('L')
while n:
    n -= 1
    cmd = stdin.readline().rstrip()
    if cmd.startswith('i'):
        dll.appendleft(int(cmd[7:]))
    elif cmd.startswith('d'):
        c = ord(cmd[6])
        if c == fcode:
            dll.popleft()
        elif c == lcode:
            dll.pop()
        else:
            try:
                dll.remove(int(cmd[7:]))
            except ValueError:
                pass
print(*dll)