output_description: Print all the element (key) in the list after the given operations. Two
  consequtive keys should be separated by a single space.
input_description: The input is given in the following format:
  
  _n_  
  _command_ 1  
  _command_ 2  
  ...  
  _command n_  
  
  In the first line, the number of operations _n_ is given. In the following _n_
  lines, the above mentioned operations are given in the following format:
  
    * insert x
    * delete x
    * deleteFirst 
    * deleteLast
attempt: from collections import deque
  
  
  def insert(linked, x):
      if x not in linked:
          linked.appendleft(x)
          return linked
  
  
  def delete(linked, x):
      if x in linked:
          linked.remove(x)
          return linked
  
  
  def deleteFirst(linked):
      del linked[0]
      return linked
  
  
  def deleteLast(linked):
      del linked[-1]
      return linked
  
  
  orders = deque([])
  n = int(input())
  
  for i in range(n):
      orders.append(list(input().split()))
  
  linked = deque([])
  
  for o in orders:
      order = o[0]
      if order == "insert":
          insert(linked, o[1])
      elif order == "delete":
          delete(linked, o[1])
      elif order == "deleteFirst":
          deleteFirst(linked)
      elif order == "deleteLast":
          deleteLast(linked)
  
  print(" ".join(map(str, linked)))
  
problem_description: Doubly Linked List
  
  Your task is to implement a double linked list.
  
  Write a program which performs the following operations:
  
    * insert x: insert an element with key x into the front of the list.
    * delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything.
    * deleteFirst: delete the first element from the list. 
    * deleteLast: delete the last element from the list.
samples: [{"input": "7\n    insert 5\n    insert 2\n    insert 3\n    insert 1\n    delete 3\n    insert 6\n    delete 5", "output": "6 1 2"}, {"input": "9\n    insert 5\n    insert 2\n    insert 3\n    insert 1\n    delete 3\n    insert 6\n    delete 5\n    deleteFirst\n    deleteLast", "output": "1"}]