list cycle detector