class ListNode:
    def __init__(self, x):
        self.val = x
        self.next = None

class Solution:
    def deleteNode(self, node):
        while True:
            if node.next:
                node.val = node.next.val
                if node.next.next:
                    node = node.next

                else:
                    node.next = None
                    break