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: class DoubleEndedList:
      # クラス内クラスを作る(CellクラスはDoubleEndedListクラスからしか参照しないため)
      class Cell:
          def __init__(self, data, prv=None, nxt=None):
              self.data = data
              self.prv = prv
              self.nxt = nxt
  
      def __init__(self):
          head = DoubleEndedList.Cell(None)
          head.prv = head
          head.nxt = head
          self.head = head
  
      def insertFirst(self, data):
          x = DoubleEndedList.Cell(data, self.head, self.head.nxt)
          self.head.nxt = x
          x.nxt.prv = x
  
      def delete(self, index):
          x = self.head
          while x.data != index:
              x = x.nxt
          x.prv.nxt = x.nxt
          x.nxt.prv = x.prv
  
  
  deque = DoubleEndedList()
  for i in range(int(input())):
      cmd = input().split()
      if cmd[0] == "insert":
          deque.insertFirst(int(cmd[1]))
      elif cmd[0] == "delete":
          deque.delete(int(cmd[1]))
      elif cmd[0] == "deleteFirst":
          deque.delete(deque.head.nxt.data)
      elif cmd[0] == "deleteLast":
          x = deque.head
          while x.nxt is not deque.head:
              x = x.nxt
          deque.delete(x.data)
      else:
          print("Wrong Command")
  n = deque.head.nxt
  while n is not deque.head:
      print(n.data, end="")
      if n.nxt is not deque.head:
          print(" ", end="")
      else:
          print("")
      n = n.nxt
  
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"}]