Psalm 119:71

71 It was good that I had to suffer in order to learn your laws.