from collections import deque

def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    for i in range(num):
        commands.append(input())

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    # dll.reverse()
    print('{0}'.format(' '.join(map(str, dll)))) from collections import deque def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64) process_command for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64) cmd commands if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
         cmd.startswith('insert') or cmd.startswith('delete ') cmd.startswith('insert') cmd.startswith cmd startswith 'insert' cmd.startswith('delete ') cmd.startswith cmd startswith 'delete ' t = cmd.split(' ') t cmd.split(' ') cmd.split cmd split ' ' cmd = t[0] cmd t[0] t 0 num_str = t[1] num_str t[1] t 1 if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64) cmd == 'insert' cmd 'insert' dll.appendleft(int(num_str)) dll.appendleft dll appendleft int(num_str) int num_str elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
         cmd == 'delete' cmd 'delete' if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
         int(num_str) in dll int(num_str) int num_str dll temp = [] temp [] result = dll.popleft() result dll.popleft() dll.popleft dll popleft while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                 result != int(num_str) result int(num_str) int num_str temp.append(result) temp.append temp append result result = dll.popleft() result dll.popleft() dll.popleft dll popleft temp = temp[::-1] temp temp[::-1] temp ::-1 -1 dll.extendleft(temp) dll.extendleft dll extendleft temp elif cmd == 'deleteFirst':
            dll.popleft()
         cmd == 'deleteFirst' cmd 'deleteFirst' dll.popleft() dll.popleft dll popleft elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64) cmd == 'deleteLast' cmd 'deleteLast' dll.pop() dll.pop dll pop dll dll commands commands if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    for i in range(num):
        commands.append(input())

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    # dll.reverse()
    print('{0}'.format(' '.join(map(str, dll)))) __name__ == '__main__' __name__ '__main__' commands = [] commands [] num = int(input()) num int(input()) int input() input for i in range(num):
        commands.append(input())

    # ??????
     i range(num) range num commands.append(input()) commands.append commands append input() input dll = deque() dll deque() deque process_command(dll, commands) process_command dll commands print('{0}'.format(' '.join(map(str, dll)))) print '{0}'.format(' '.join(map(str, dll))) '{0}'.format '{0}' format ' '.join(map(str, dll)) ' '.join ' ' join map(str, dll) map str dll num = int(input()) int(input()) num dll = deque() deque() dll def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64) def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64) process_command commands = [] [] commands
from collections import deque

def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            if int(num_str) in dll:
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    for i in range(num):
        commands.append(input())

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    # dll.reverse()
    print('{0}'.format(' '.join(map(str, dll))))