Update 531.py

Added ability to go down a cycle