Fixed

-Had to track the state of cycles
-Had to add ArrayList due to out of order input