Niccolò Machiavelli said this quote

Wisdom consists of knowing how to distinguish the nature of trouble, and in choosing the lesser evil.