public static ListNode insertionSortList(ListNode head) {
        if (head == null || head.next ==null) {
            return head;
        }
        
        ListNode dummy = new ListNode(0);
        dummy.next = head;
        
        ListNode p = dummy;
        ListNode q = p.next;
        while ( q != null) {
            ListNode it = dummy;
            while (it.next.val < q.val) {
                it = it.next;
            }
            if (it.next == q) {
                p = p.next;
                q = p.next;
            }
            else {
                p.next = q.next;
                q.next = it.next;
                it.next = q;
                q = p.next;
            }
        }
        return dummy.next;
    }