def pop(self):
     if self.top:
         val = self.top.value
         self.top = self.top.next
         return val
     else:
         raise InvalidOperationError(
             "Method not allowed on empty collection")
    def dequeue(self):
        if self.front:

            temp = self.front
            self.front = self.front.next
            temp.next = None

            return temp.value
        else:
            raise InvalidOperationError(
                "Method not allowed on empty collection")
 def peek(self):
     if self.front:
         return self.front.value
     else:
         raise InvalidOperationError(
             "Method not allowed on empty collection")