Check for cyclic linked list