reverse linkedlist and find loops