/**
 * struct ListNode {
 *	int val;
 *	struct ListNode *next;
 * };
 */

/**
 * 
 * @param pHead1 ListNode类 
 * @param pHead2 ListNode类 
 * @return ListNode类
 */
struct ListNode* Merge(struct ListNode* pHead1, struct ListNode* pHead2 ) {
    // write code here
    if (pHead1 == NULL) {
        return pHead2;
    } else if (pHead2 == NULL) {
        return pHead1;
    } else if (pHead1->val < pHead2->val) {
        pHead1->next = Merge(pHead1->next, pHead2);
        return pHead1;
    } else {
        pHead2->next = Merge(pHead1, pHead2->next);
        return pHead2;
    }
}