After completely rinsing your media the activated carbon should go in the top basket. Then bio balls in the middle and ceramic rings in the bottom. If there are four trays, you can split the bio balls between two trays or fill this with more media of your choice.
The foams can go on the top or bottom of the media and one in each tray. Although, you can also stack them all at the top.