It's pretty simple - but it would take far too much language to explain.
Instead, get four pieces of paper. Write a digit from 1 to 4 at the top of each, so they are all different, and you can tell then apart.
Now, divide each sheep in two with a vertical line. Label the left side "Previous" and the right side "Next". Write a digit in each side so the sheets look like this:
Sheet Next Previous
1 2 0
2 3 1
3 4 2
4 0 3
Now, start in your program points to sheet four
Run your program through through, and watch what happens to the sheets.