人間万事塞翁が馬
also: じんかんばんじさいおうがうま
Meanings
1
life is full of ups and downs; fortune is unpredictable
A proverb derived from a Chinese story: an old man's horse runs away, but later returns with another horse, and his son's injury from riding prevents him from being drafted. Teaches that misfortune may turn into fortune and vice versa; often used to console someone after a setback.
I failed the exam, but as they say, 'life is full of ups and downs,' so something good will surely come of it.
Since fortune is unpredictable, don't worry too much about this failure.