in difficulty you need not to seek the perfect solution; any solution will suffice.
The first known publication of the phrase was in a 1749 erotic novel: John Cleland's Fanny Hill: Memoirs of a Woman of Pleasure.