The question, and my first attempt.



And now a guess at how to solve this.