class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def deleteDuplicates(head: ListNode) -> ListNode:
    current = head
    
    while current and current.next:
        if current.val == current.next.val:
            current.next = current.next.next  # تخطي العنصر المكرر
        else:
            current = current.next  # الانتقال إلى العنصر التالي
            
    return head

# دالة لمساعدتك في اختبار الكود
def printList(head: ListNode):
    current = head
    while current:
        print(current.val, end=" -> ")
        current = current.next
    print("None")

# اختبار الكود
# إنشاء قائمة مرتبطة: 1 -> 1 -> 2
head = ListNode(1)
head.next = ListNode(1)
head.next.next = ListNode(2)

print("Original list:")
printList(head)

# إزالة العناصر المكررة
new_head = deleteDuplicates(head)

print("List after removing duplicates:")
printList(new_head)