Napoleon Hill said this quote

Every adversity, every failure, every heartache carries with it the seed of an equal or greater benefit.