class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def deleteDuplicates(head):
        if not head:
            return head.val

        current = head
        while current.next:
            if current.val == current.next.val:
               current.next = current.next.next
            else:
                current = current.next
        return head.val

if __name__ == "__main__":
  
    
        head =ListNode(1)
        head.next=ListNode(1)
        head.next.next =ListNode(2)
        head.next.next.next =ListNode(2)
        head.next.next.next.next =ListNode(3)
      
      
(deleteDuplicates(head))
print(head.val)
print (head.next.val)
print (head.next.next.val)
#print (head.next.next.next.val)



        