class Solution {
public:
    ListNode* EntryNodeOfLoop(ListNode* pHead)
    {
        unordered_map<ListNode*, bool> nodemap;
        while(pHead){
            if(nodemap.find(pHead) != nodemap.end()) return pHead;
            else{
                nodemap[pHead] = true;
            }
            pHead = pHead->next;
        }
        return nullptr;
    }
};