refactor wolf,sheet and cabbage question