class Element(object):
    def __init__(self, value):
        self.value = value
        self.next = None
class LinkedList(object):
    def __init__(self, head=None):
        self.head = head
def append(self, new_element):
        current = self.head
        if self.head:
            while current.next:
                current = current.next
            current.next = new_element
        else:
            self.head = new_element
def insert_first(self, new_element):
        new_element.next = self.head
        self.head = new_element
def delete_first(self):
        if self.head:
            deleted_element = self.head
            temp = deleted_element.next
            self.head = temp
            return deleted_element
        else:
            return None
class Stack(object):
    def __init__(self,top=None): #when initiate, only has one top element
        self.ll = LinkedList(top)
def push(self, new_element):
        self.ll.insert_first(new_element)
def pop(self):
        return self.ll.delete_first()
