class Solution:
def detectCycle(self, head: ListNode) -> ListNode:
fast=head
slow=head
while fast and fast.next:
fast=fast.next.next
slow=slow.next#快慢指针法判断是否有环
if (fast==slow):#快慢指针相遇点
index1=head
index2=fast
while(index1!=index2):#找环的入口
index1=index1.next
index2=index2.next
return index2
return None