/**
 * struct ListNode {
 *	int val;
 *	struct ListNode *next;
 * };
 */
/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 
 * @param pHead ListNode类 
 * @return ListNode类
 */
struct ListNode* EntryNodeOfLoop(struct ListNode* head ) {
    // write code here
    struct ListNode *quick,*slow;
     quick = slow = head;
     while(quick && quick->next)
     {
        quick = quick->next->next;
         slow = slow->next;
         if(quick == slow)
         {
            struct ListNode*meetnode = quick;
            while(meetnode != head)
            {
                meetnode = meetnode->next;
                head = head->next;
            }
            return meetnode;
         }
     }
     return NULL;
}