#include <iostream>
#include <list>

using namespace std;

struct ListNode {
  int m_Value;
  ListNode *m_Next;
};

bool hasLoop(ListNode *pHead) {
  if(pHead==NULL)
    return false;

  ListNode *pSlow = pHead->m_Next;
  if(pSlow==NULL)
    return false;

  ListNode *pFast = pSlow->m_Next;
  while(pFast!=NULL && pSlow!=NULL) {
    if(pFast==pSlow)
      return true;

    pSlow = pSlow->m_Next;
    
    pFast = pFast->m_Next;
    if(pFast!=NULL)
      pFast = pFast->m_Next;
  }

  return false;
}

int main(int argc, char **argv) {

  return 0;
}
