No hay mal que por bien no venga.
“There is no bad from which some good does not come.”
Even misfortune can eventually lead to something beneficial.
— Traditional Peru Wisdom, Peru
Source: Traditional Spanish-language proverb used in Peru; public-domain oral tradition