from collections import deque

def readinput():
    n = int(input())
    commands = []
    for i in range(n):
        command = input().split()
        commands.append(command)
    return n,commands

def main(n,commands):
    l = deque([])
    for i in range(n):
        command = commands[i]
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
    
def main2():
    n = int(input())
    l = deque([])
    for i in range(n):
        command = input().split()
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
if __name__=='__main__':
    #n, commands=readinput()
    #ans = main(n,commands)
    ans = main2()
    print(' '.join(ans)) from collections import deque def readinput():
    n = int(input())
    commands = []
    for i in range(n):
        command = input().split()
        commands.append(command)
    return n,commands readinput n = int(input()) n int(input()) int input() input commands = [] commands [] for i in range(n):
        command = input().split()
        commands.append(command)
     i range(n) range n command = input().split() command input().split() ().split () input split commands.append(command) commands.append commands append command return n,commands return n,commands n commands def main(n,commands):
    l = deque([])
    for i in range(n):
        command = commands[i]
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
     main l = deque([]) l deque([]) deque [] for i in range(n):
        command = commands[i]
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

     i range(n) range n command = commands[i] command commands[i] commands i if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

     command[0]=='insert' command[0] command 0 'insert' op = command[1] op command[1] command 1 l.appendleft(op) l.appendleft l appendleft op elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
         command[0]=='delete' command[0] command 0 'delete' op = command[1] op command[1] command 1 try:
                l.remove(op)
            except:
                pass
         except:
                pass
         l.remove(op) l.remove l remove op elif(command[0]=='deleteFirst'):
            l.popleft()
         command[0]=='deleteFirst' command[0] command 0 'deleteFirst' l.popleft() l.popleft l popleft elif(command[0]=='deleteLast'):
            l.pop()
         command[0]=='deleteLast' command[0] command 0 'deleteLast' l.pop() l.pop l pop return l l n n commands commands def main2():
    n = int(input())
    l = deque([])
    for i in range(n):
        command = input().split()
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l main2 n = int(input()) n int(input()) int input() input l = deque([]) l deque([]) deque [] for i in range(n):
        command = input().split()
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

     i range(n) range n command = input().split() command input().split() ().split () input split if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

     command[0]=='insert' command[0] command 0 'insert' op = command[1] op command[1] command 1 l.appendleft(op) l.appendleft l appendleft op elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
         command[0]=='delete' command[0] command 0 'delete' op = command[1] op command[1] command 1 try:
                l.remove(op)
            except:
                pass
         except:
                pass
         l.remove(op) l.remove l remove op elif(command[0]=='deleteFirst'):
            l.popleft()
         command[0]=='deleteFirst' command[0] command 0 'deleteFirst' l.popleft() l.popleft l popleft elif(command[0]=='deleteLast'):
            l.pop()
         command[0]=='deleteLast' command[0] command 0 'deleteLast' l.pop() l.pop l pop return l l if __name__=='__main__':
    #n, commands=readinput()
    #ans = main(n,commands)
    ans = main2()
    print(' '.join(ans)) __name__=='__main__' __name__ '__main__' ans = main2() ans main2() main2 print(' '.join(ans)) print ' '.join(ans) ' '.join ' ' join ans def main2():
    n = int(input())
    l = deque([])
    for i in range(n):
        command = input().split()
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l def main2():
    n = int(input())
    l = deque([])
    for i in range(n):
        command = input().split()
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l main2 ans = main2() main2() ans def readinput():
    n = int(input())
    commands = []
    for i in range(n):
        command = input().split()
        commands.append(command)
    return n,commands def readinput():
    n = int(input())
    commands = []
    for i in range(n):
        command = input().split()
        commands.append(command)
    return n,commands readinput def main(n,commands):
    l = deque([])
    for i in range(n):
        command = commands[i]
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
     def main(n,commands):
    l = deque([])
    for i in range(n):
        command = commands[i]
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
     main
from collections import deque

def readinput():
    n = int(input())
    commands = []
    for i in range(n):
        command = input().split()
        commands.append(command)
    return n,commands

def main(n,commands):
    l = deque([])
    for i in range(n):
        command = commands[i]
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
    
def main2():
    n = int(input())
    l = deque([])
    for i in range(n):
        command = input().split()
        if (command[0]=='insert'):
            op = command[1]
            l.appendleft(op)
        elif(command[0]=='delete'):
            op = command[1]
            try:
                l.remove(op)
            except:
                pass
        elif(command[0]=='deleteFirst'):
            l.popleft()
        elif(command[0]=='deleteLast'):
            l.pop()
        else:
            pass
        #print(' '.join(l))

    return l
if __name__=='__main__':
    #n, commands=readinput()
    #ans = main(n,commands)
    ans = main2()
    print(' '.join(ans))
