python: linked list cycle ii