Solves Reve's puzzle, but not optimal solution