Help getting started!

Logically the simplest way to do it would be to have an outer loop and four inner loops: study, restudy, retrieval and test. The study and restudy loops should contain the same routine but given your interleaving it might be better to have different retrieval routines, since they will need to point to different stimuli.

Before the first loop you will probably need a routine with a code component that sets up which loops will run and the list of items to be used in each loop.

Have a look at some of my online demos such as Independent Randomisation and Trial Switching