Quantum walks with memory on cycles