How to cross a river (with all your oxen surviving)