public static RandomListNode copyRandomList(RandomListNode head) {//AC
    	if (head == null) return null;
        RandomListNode p = head;
        while (p != null) {
        	RandomListNode p_dup = new RandomListNode(p.label);
        	p_dup.next = p.next;
        	p.next = p_dup;
        	p = p_dup.next;
        }
        p = head;
        RandomListNode p_next;
        while (p != null) {
        	p_next = p.next;
        	if (p.random != null) p_next.random = p.random.next;
        	p = p_next.next;
        }
        p = head;
        RandomListNode newhead = head == null ? null : p.next;
        RandomListNode newtail = newhead;
        while (p != null) {
        	p.next = newtail.next;
        	if (newtail.next != null) newtail.next = newtail.next.next;
        	p = p.next;
        	newtail = newtail.next;
        }
        return newhead;
    }