n = int(raw_input())
x = [0 for i in range(n)]
pf = -1
pb = 0

li = []
for i in range(n):
    s = (raw_input().split())
    if s[0] == 'insert':
        pf += 1
        x[pf]=int(s[1])
    elif s[0] == 'delete':
        try:
            p = x[pf::-1].index(int(s[1]))
            x[pf-p] = 0
            while x[pf]==0:
                pf -= 1
            while x[pb]==0:
                pb += 1
        except:
            pass
    elif s[0] == 'deleteFirst':
        x[pf]=0
        pf -= 1
    elif s[0] == 'deleteLast':
        x[pb] = 0
        pb += 1
for e in x[pb:pf+1][::-1]:
    if e != 0:
        print e, n = int(raw_input()) n int(raw_input()) int raw_input() raw_input 0 for i in range(n) for i in range(n) i range(n) range n for i in range(n) 0 x = [0 for i in range(n)] x [0 for i in range(n)] pf = -1 pf -1 pb = 0 pb 0 li = [] li [] for i in range(n):
    s = (raw_input().split())
    if s[0] == 'insert':
        pf += 1
        x[pf]=int(s[1])
    elif s[0] == 'delete':
        try:
            p = x[pf::-1].index(int(s[1]))
            x[pf-p] = 0
            while x[pf]==0:
                pf -= 1
            while x[pb]==0:
                pb += 1
        except:
            pass
    elif s[0] == 'deleteFirst':
        x[pf]=0
        pf -= 1
    elif s[0] == 'deleteLast':
        x[pb] = 0
        pb += 1 i range(n) range n s = (raw_input().split()) s raw_input().split() ().split () raw_input split if s[0] == 'insert':
        pf += 1
        x[pf]=int(s[1])
    elif s[0] == 'delete':
        try:
            p = x[pf::-1].index(int(s[1]))
            x[pf-p] = 0
            while x[pf]==0:
                pf -= 1
            while x[pb]==0:
                pb += 1
        except:
            pass
    elif s[0] == 'deleteFirst':
        x[pf]=0
        pf -= 1
    elif s[0] == 'deleteLast':
        x[pb] = 0
        pb += 1 s[0] == 'insert' s[0] s 0 'insert' pf += 1 pf 1 x[pf]=int(s[1]) x[pf] x pf int(s[1]) int s[1] s 1 elif s[0] == 'delete':
        try:
            p = x[pf::-1].index(int(s[1]))
            x[pf-p] = 0
            while x[pf]==0:
                pf -= 1
            while x[pb]==0:
                pb += 1
        except:
            pass
     s[0] == 'delete' s[0] s 0 'delete' try:
            p = x[pf::-1].index(int(s[1]))
            x[pf-p] = 0
            while x[pf]==0:
                pf -= 1
            while x[pb]==0:
                pb += 1
        except:
            pass
     except:
            pass
     p = x[pf::-1].index(int(s[1])) p x[pf::-1].index(int(s[1])) [pf::-1].index [pf::-1] x pf::-1 pf -1 index int(s[1]) int s[1] s 1 x[pf-p] = 0 x[pf-p] x pf-p pf p 0 while x[pf]==0:
                pf -= 1
             x[pf]==0 x[pf] x pf 0 pf -= 1 pf 1 while x[pb]==0:
                pb += 1
         x[pb]==0 x[pb] x pb 0 pb += 1 pb 1 elif s[0] == 'deleteFirst':
        x[pf]=0
        pf -= 1
     s[0] == 'deleteFirst' s[0] s 0 'deleteFirst' x[pf]=0 x[pf] x pf 0 pf -= 1 pf 1 elif s[0] == 'deleteLast':
        x[pb] = 0
        pb += 1 s[0] == 'deleteLast' s[0] s 0 'deleteLast' x[pb] = 0 x[pb] x pb 0 pb += 1 pb 1 for e in x[pb:pf+1][::-1]:
    if e != 0:
        print e, e x[pb:pf+1][::-1] [pb:pf+1] x pb:pf+1 pb pf+1 pf 1 ::-1 -1 if e != 0:
        print e, e != 0 e 0 print e pf -= 1 1 pf li = [] [] li pb += 1 1 pb s = (raw_input().split()) raw_input().split() s pf += 1 1 pf p = x[pf::-1].index(int(s[1])) x[pf::-1].index(int(s[1])) p pb += 1 1 pb pf -= 1 1 pf x = [0 for i in range(n)] [0 for i in range(n)] x n = int(raw_input()) int(raw_input()) n pf = -1 -1 pf pb = 0 0 pb
n = int(raw_input())
x = [0 for i in range(n)]
pf = -1
pb = 0

li = []
for i in range(n):
    s = (raw_input().split())
    if s[0] == 'insert':
        pf += 1
        x[pf]=int(s[1])
    elif s[0] == 'delete':
        try:
            p = x[pf::-1].index(int(s[1]))
            x[pf-p] = 0
            while x[pf]==0:
                pf -= 1
            while x[pb]==0:
                pb += 1
        except:
            pass
    elif s[0] == 'deleteFirst':
        x[pf]=0
        pf -= 1
    elif s[0] == 'deleteLast':
        x[pb] = 0
        pb += 1
for e in x[pb:pf+1][::-1]:
    if e != 0:
        print e,