detect linked list cycle and return it