def copy_random_pointer_v2(head):
copy = defaultdict(lambda: RandomListNode(<NUM_LIT:0>))<EOL>copy[None] = None<EOL>node = head<EOL>while node:<EOL><INDENT>copy[node].label = node.label<EOL>copy[node].next = copy[node.next]<EOL>copy[node].random = copy[node.random]<EOL>node = node.next<EOL><DEDENT>return copy[head]<EOL>
:type head: RandomListNode
:rtype: RandomListNode