private ListNode mergeTwoLists(ListNode n1, ListNode n2) {
        ListNode dummy = new ListNode(-1);
        ListNode tail = dummy;
        while (n1 != null && n2 != null) {
            if (n1.val < n2.val) {
                tail.next = n1;
                tail = n1;
                n1 = n1.next;
            } else {
                tail.next = n2;
                tail = n2;
                n2 = n2.next;
            }
        }
        if (n1 == null) tail.next = n2;
        else if (n2 == null) tail.next = n1;
        return dummy.next;
    }