added solution for cycle detection (no cycle location)