# -*- coding:utf-8 -*-
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def EntryNodeOfLoop(self, pHead):
# write code here
fast = slow = pHead
while fast != None and fast.next != None:
slow = slow.next
fast = fast.next.next
if fast == slow:
break
if fast == None or fast.next == None:
return None
fast = pHead
while fast != slow:
fast = fast.next
slow = slow.next
return fast