detect a loop in linked list and print the beginning of the loop