Finding maximum cycling length