How to solve the riddle of the goat cabbage and wolf