public static ListNode sortList(ListNode head) {
        if(head==null || head.next==null)return head;
        else{
            ListNode rest = sortList(head.next);
            if(rest ==null)return head;
            
            if(head.val<=rest.val){head.next=rest;return head;}
            
            ListNode tmp=null;
            ListNode n=null;
            for( n=rest;n!=null;tmp=n,n=n.next){
                if(head.val<=n.val)break;
            }
            
            if(n==null){
                tmp.next=head;
                head.next =null;
                return rest;
            }else{
                tmp.next = head;
                head.next =n;
                return rest;
            }
            
            
        }
        
        
    }