6 from room 2, move to room 3. for this room, you need the number 7. once you get that, move to room 4, and in this room, you need the number 1. in the next rooms, you need the number 2, 3, and 4. the highest that the rocks go to is 7, so once you got a 7 in a room, you have to get 1 in the next room.
if you can't understand the pattern, it's simple: if you start with 5, keep getting the next number in each room. once you get 7, then the next room will ask for 1, then 2 in the next room, 