Buggy python submission (verdict: Runtime Error):
n = int(input())
xlist = []
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        if (len(xlist) == 0):
            xlist.append(int(x))
        else:
            xlist.append(int(x))
            for i in range(1,len(xlist)):
                k = len(xlist) - i 
                j = k-1
                xlist[j], xlist[k] = xlist[k], xlist[j]
    elif (command[0] == 'delete'):
        x = command[1]
        if int(x) in xlist :
            xlist.remove(int(x))
    elif (command[0] == 'deleteFirst'):
        if (len(xlist) > 0):
            del xlist[0]
    elif (command[0] == 'deleteLast'):
        if (len(xlist) > 0):
            del xlist[-1]
nx = len(xlist)
for i in range(n):
    if ( i == n-1):
        print('{}'.format(xlist[i]), end = '')
    else:
        print('{}'.format(xlist[i]), end = ' ')


Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xlist = []
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        if (len(xlist) == 0):
            xlist.append(int(x))
        else:
            xlist.append(int(x))
            for i in range(1,len(xlist)):
                k = len(xlist) - i 
                j = k-1
                xlist[j], xlist[k] = xlist[k], xlist[j]
        #print(xlist)
    elif (command[0] == 'delete'):
        x = command[1]
        if (int(x) in xlist) :
            xlist.remove(int(x))
        #print(xlist)
    elif (command[0] == 'deleteFirst'):
        if (len(xlist) > 0):
            del xlist[0]
        #print(xlist)
    elif (command[0] == 'deleteLast'):
        if (len(xlist) > 0):
            del xlist[-1]
        #print(xlist)
n = len(xlist)
for i in range(n):
    if (i == n-1):
        print('{}'.format(xlist[i]), end = '')
    else:
        print('{} '.format(xlist[i]), end = '')
print()


Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xlist = []
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        if (len(xlist) == 0):
            xlist.append(int(x))
        else:
            xlist = [int(x)] + xlist
        #print(xlist)
    elif (command[0] == 'delete'):
        x = command[1]
        if (int(x) in xlist) :
            xlist.remove(int(x))
        #print(xlist)
    elif (command[0] == 'deleteFirst'):
        if (len(xlist) > 0):
            del xlist[0]
        #print(xlist)
    elif (command[0] == 'deleteLast'):
        if (len(xlist) > 0):
            del xlist[-1]
        #print(xlist)
n = len(xlist)
for i in range(n):
    if (i == n-1):
        print('{}'.format(xlist[i]), end = '')
    else:
        print('{} '.format(xlist[i]), end = '')
print()


Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xlist = []
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        if (len(xlist) == 0):
            xlist.append(int(x))
        else:
            xlist = [int(x)] + xlist
        #print(xlist)
    elif (command[0] == 'delete'):
        x = command[1]
        if (int(x) in xlist) :
            xlist.remove(int(x))
        #print(xlist)
    elif (command[0] == 'deleteFirst'):
        if (len(xlist) > 0):
            xlist.pop(0)
        #print(xlist)
    elif (command[0] == 'deleteLast'):
        if (len(xlist) > 0):
            xlist.pop(-1)
        #print(xlist)
n = len(xlist)
for i in range(n):
    if (i == n-1):
        print('{}'.format(xlist[i]), end = '')
    else:
        print('{} '.format(xlist[i]), end = '')
print()


Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
xlist = []
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        if (len(xlist) == 0):
            xlist.append(int(x))
        else:
            xlist = [int(x)] + xlist
        #print(xlist)
    elif (command[0] == 'delete'):
        x = command[1]
        if (int(x) in xlist) :
            xlist.remove(int(x))
        #print(xlist)
    elif (command[0] == 'deleteFirst'):
        if (len(xlist) > 0):
            xlist.pop(0)
        #print(xlist)
    elif (command[0] == 'deleteLast'):
        if (len(xlist) > 0):
            xlist.pop(-1)
        #print(xlist)
n = len(xlist)
for i in range(n):
    if (i == n-1):
        print('{}'.format(xlist[i]), end = '')
    else:
        print('{} '.format(xlist[i]), end = '')
print()


Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n = int(input())
xdeque = deque()
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        xdeque.appendleft(int(x))
        #print(xlist)
    elif (command[0] == 'delete'):
        x = command[1]
        if (int(x) in xdeque) :
            xdeque.remove(int(x))
        #print(xlist)
    elif (command[0] == 'deleteFirst'):
        xdeque.popleft()
        #print(xlist)
    elif (command[0] == 'deleteLast'):
        xdeque.pop()
        #print(xlist)
print(*xdeque)




Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Runtime Error):
from collections import deque   ##deque 라는 데이터형 편리한듯. print도그렇고 append,pop속도도 빠르고
n = int(input())
xdeque = deque()
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        xdeque.appendleft(int(x))
    elif (command[0] == 'delete'):
        x = command[1]
        try:
            d.remove(int(x))
        except ValueError:
            pass
    elif (command[0] == 'deleteFirst'):
        xdeque.popleft()
    else:
        xdeque.pop()
print(*xdeque)




Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque   ##deque 라는 데이터형 편리한듯. print도그렇고 append,pop속도도 빠르고
n = int(input())
xdeque = deque()
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        xdeque.appendleft(int(x))
    elif (command[0] == 'delete'):
        x = command[1]
        try:
            xdeque.remove(int(x))
        except ValueError:
            pass
    elif (command[0] == 'deleteFirst'):
        xdeque.popleft()
    else:
        xdeque.pop()
print(*xdeque)




Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque   ##deque 라는 데이터형 편리한듯. print도그렇고 append,pop속도도 빠르고
n = int(input())
xdeque = deque()
for i in range(n):
    command = input().split()
    if (command[0][0] == 'i'):
        x = command[1]
        xdeque.appendleft(int(x))
    elif (command[0] == 'delete'):
        x = command[1]
        try:
            xdeque.remove(int(x))
        except ValueError:
            pass
    elif (command[0][6] == 'F'):
        xdeque.popleft()
    else:
        xdeque.pop()
print(*xdeque)




Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

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




Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

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



Fixed submission:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))

Buggy python submission (verdict: Runtime Error):
from collections import deque   
n = int(input())
d = deque()
for _ in range(n):
    x = input().split()
    if (command[0][0] == 'i'):
        d.appendleft(int(x[1]))
    elif (command[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:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(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:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(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:
from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))