class Node():
    def __init__(self,data=None):
        self.data=data
        self.next=None
        
class LinkedList():
    def __init__(self,head=None):
        self.head=head
        
    def PrintList(self):
        temp = self.head
        while temp:
            print(temp.data)
            temp = temp.next
            
    def Push(self,new_data):
        new_node = Node(new_data)
        new_node.next = self.head
        self.head = new_node
        
    def AddAfter(self,prev_node,new_data):
        new_node = Node(new_data)
        new_node.next = prev_node.next
        prev_node.next = new_node
    
    def append(self,new_data):
        new_node = Node(new_data)
        temp = self.head
        while temp.next:
            temp = temp.next
        temp.next = new_node
    
    def delete(self,pos):
        
        temp = self.head
        prev = None
        count = 0
        
        while temp and count!=pos:
            prev = temp
            temp = temp.next
            count +=1
            
        prev.next = temp.next
        temp = None
        
        
