Psalm 119:67; Psalm 119:71

67 Before I was afflicted I went astray, but now I obey your word.
71 It was good for me to be afflicted so that I might learn your decrees.